fix ios notifications

This commit is contained in:
Lorito Tiago
2023-10-09 14:15:21 +01:00
parent 76f8ac976a
commit cca49822b3
70 changed files with 7451 additions and 44713 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = { const config: CapacitorConfig = {
appId: 'com.capacitorjs.app.testapp', appId: 'com.capacitorjs.app.testapp',
appName: 'capacitor-testapp', appName: 'Gabinete Digital',
webDir: 'www', webDir: 'www',
plugins: { plugins: {
SplashScreen: { SplashScreen: {
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d</string>
<key>API_KEY</key>
<string>AIzaSyCDW6bjQSiSAVCYhai7nFV1wWnLMV_kBeM</string>
<key>GCM_SENDER_ID</key>
<string>800733765231</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.gpr.gabinetedigital.teste</string>
<key>PROJECT_ID</key>
<string>gabinete-digital-2020</string>
<key>STORAGE_BUCKET</key>
<string>gabinete-digital-2020.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:800733765231:ios:af4d35631d70473213779a</string>
<key>DATABASE_URL</key>
<string>https://gabinete-digital-2020.firebaseio.com</string>
</dict>
</plist>
+17 -3
View File
@@ -15,6 +15,7 @@
504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; }; 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };
50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; }; 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; }; A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; };
DAD1AB3F2ACF3A7F001D9958 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DAD1AB3D2ACF39DE001D9958 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@@ -34,6 +35,8 @@
DA6FE4D62ACEF2DA006F1E0D /* FirebaseCoreInternal.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseCoreInternal.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA6FE4D62ACEF2DA006F1E0D /* FirebaseCoreInternal.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseCoreInternal.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA6FE4D72ACEF2DA006F1E0D /* FirebaseInstallations.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseInstallations.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA6FE4D72ACEF2DA006F1E0D /* FirebaseInstallations.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseInstallations.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA6FE4D82ACEF2DA006F1E0D /* FirebaseMessaging.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseMessaging.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA6FE4D82ACEF2DA006F1E0D /* FirebaseMessaging.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseMessaging.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA8422AF2AD03FBE00AC9118 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
DAD1AB3D2ACF39DE001D9958 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../Downloads/App 2023-09-14 12-28-07/GoogleService-Info.plist"; sourceTree = "<group>"; };
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 = "<group>"; }; 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 = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@@ -83,8 +86,10 @@
504EC3061FED79650016851F /* App */ = { 504EC3061FED79650016851F /* App */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
DA8422AF2AD03FBE00AC9118 /* App.entitlements */,
50379B222058CBB4000EE86E /* capacitor.config.json */, 50379B222058CBB4000EE86E /* capacitor.config.json */,
504EC3071FED79650016851F /* AppDelegate.swift */, 504EC3071FED79650016851F /* AppDelegate.swift */,
DAD1AB3D2ACF39DE001D9958 /* GoogleService-Info.plist */,
504EC30B1FED79650016851F /* Main.storyboard */, 504EC30B1FED79650016851F /* Main.storyboard */,
504EC30E1FED79650016851F /* Assets.xcassets */, 504EC30E1FED79650016851F /* Assets.xcassets */,
504EC3101FED79650016851F /* LaunchScreen.storyboard */, 504EC3101FED79650016851F /* LaunchScreen.storyboard */,
@@ -134,7 +139,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0920; LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0920; LastUpgradeCheck = 1420;
TargetAttributes = { TargetAttributes = {
504EC3031FED79650016851F = { 504EC3031FED79650016851F = {
CreatedOnToolsVersion = 9.2; CreatedOnToolsVersion = 9.2;
@@ -175,6 +180,7 @@
50379B232058CBB4000EE86E /* capacitor.config.json in Resources */, 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */,
504EC30D1FED79650016851F /* Main.storyboard in Resources */, 504EC30D1FED79650016851F /* Main.storyboard in Resources */,
2FAD9763203C412B000D30F8 /* config.xml in Resources */, 2FAD9763203C412B000D30F8 /* config.xml in Resources */,
DAD1AB3F2ACF3A7F001D9958 /* GoogleService-Info.plist in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -276,6 +282,7 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
@@ -283,8 +290,10 @@
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -333,6 +342,7 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
@@ -340,8 +350,10 @@
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -375,9 +387,10 @@
baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */; baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 15; CURRENT_PROJECT_VERSION = 36;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
INFOPLIST_FILE = App/Info.plist; INFOPLIST_FILE = App/Info.plist;
@@ -403,9 +416,10 @@
baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */; baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 15; CURRENT_PROJECT_VERSION = 36;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
INFOPLIST_FILE = App/Info.plist; INFOPLIST_FILE = App/Info.plist;
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
+13 -7
View File
@@ -12,22 +12,24 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Override point for customization after application launch. // Override point for customization after application launch.
// Specify the custom file path // Specify the custom file path
let customGoogleServiceInfoPlistPath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist") // let customGoogleServiceInfoPlistPath = Bundle.main.path(forResource: "11", ofType: "plist")
// Check if the custom plist file exists // Check if the custom plist file exists
if let filePath = customGoogleServiceInfoPlistPath, // if let filePath = customGoogleServiceInfoPlistPath,
let fileOptions = FirebaseOptions(contentsOfFile: filePath) { // let fileOptions = FirebaseOptions(contentsOfFile: filePath) {
FirebaseApp.configure(options: fileOptions) // FirebaseApp.configure(options: fileOptions)
} else { // } else {
// Handle the case where the custom plist file is not found // Handle the case where the custom plist file is not found
print("Custom GoogleService-Info.plist not found or invalid.") // print("Custom GoogleService-Info.plist not found or invalid.")
FirebaseApp.configure() FirebaseApp.configure()
} //}
return true return true
} }
func applicationWillResignActive(_ application: UIApplication) { 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. // 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.
@@ -66,9 +68,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken) NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
Messaging.messaging().apnsToken = deviceToken
} }
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error) NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d</string>
<key>API_KEY</key>
<string>AIzaSyCDW6bjQSiSAVCYhai7nFV1wWnLMV_kBeM</string>
<key>GCM_SENDER_ID</key>
<string>800733765231</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.gpr.gabinetedigital.teste</string>
<key>PROJECT_ID</key>
<string>gabinete-digital-2020</string>
<key>STORAGE_BUCKET</key>
<string>gabinete-digital-2020.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:800733765231:ios:af4d35631d70473213779a</string>
<key>DATABASE_URL</key>
<string>https://gabinete-digital-2020.firebaseio.com</string>
</dict>
</plist>
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d</string>
<key>API_KEY</key>
<string>AIzaSyCDW6bjQSiSAVCYhai7nFV1wWnLMV_kBeM</string>
<key>GCM_SENDER_ID</key>
<string>800733765231</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.gpr.gabinetedigital.teste</string>
<key>PROJECT_ID</key>
<string>gabinete-digital-2020</string>
<key>STORAGE_BUCKET</key>
<string>gabinete-digital-2020.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:800733765231:ios:af4d35631d70473213779a</string>
<key>DATABASE_URL</key>
<string>https://gabinete-digital-2020.firebaseio.com</string>
</dict>
</plist>
+11 -7
View File
@@ -2,16 +2,18 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>NSCameraUsageDescription</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>Privacy - Camera Usage Description</string> <true/>
<key>NSPhotoLibraryAddUsageDescription</key> <key>UNUserNotificationCenterDelegate</key>
<string>Privacy - Photo Library Additions Usage Description</string> <string>YourApp.NotificationDelegate</string>
<key>NSPhotoLibraryUsageDescription</key> <key>UIBackgroundModes</key>
<string>Privacy - Photo Library Usage Description</string> <array>
<string>remote-notification</string>
</array>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>capacitor-testapp</string> <string>Gabinete Digital</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@@ -42,6 +44,8 @@
<string>This app needs your location to test the location feature of the Google Maps plugin.</string> <string>This app needs your location to test the location feature of the Google Maps plugin.</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>Used to capture audio for image picker plugin</string> <string>Used to capture audio for image picker plugin</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Privacy - Photo Library Additions Usage Description</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>Used to demonstrate image picker plugin</string> <string>Used to demonstrate image picker plugin</string>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
-36
View File
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.800733765231-5da370m1mntjk7cg8cc2d331sp8cj91d</string>
<key>API_KEY</key>
<string>AIzaSyCDW6bjQSiSAVCYhai7nFV1wWnLMV_kBeM</string>
<key>GCM_SENDER_ID</key>
<string>800733765231</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.gpr.gabinetedigital.teste</string>
<key>PROJECT_ID</key>
<string>gabinete-digital-2020</string>
<key>STORAGE_BUCKET</key>
<string>gabinete-digital-2020.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:800733765231:ios:af4d35631d70473213779a</string>
<key>DATABASE_URL</key>
<string>https://gabinete-digital-2020.firebaseio.com</string>
</dict>
</plist>
+1
View File
@@ -11,6 +11,7 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCommunityFcm', :path => '../../node_modules/@capacitor-community/fcm'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser' pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera' pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
+7287 -44350
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -46,19 +46,20 @@
"@awesome-cordova-plugins/file": "^5.41.0", "@awesome-cordova-plugins/file": "^5.41.0",
"@awesome-cordova-plugins/file-opener": "^5.41.0", "@awesome-cordova-plugins/file-opener": "^5.41.0",
"@awesome-cordova-plugins/multiple-document-picker": "^5.40.0", "@awesome-cordova-plugins/multiple-document-picker": "^5.40.0",
"@capacitor/android": "^4.6.2", "@capacitor-community/fcm": "^5.0.2",
"@capacitor/android": "^5.4.2",
"@capacitor/app": "^4.1.1", "@capacitor/app": "^4.1.1",
"@capacitor/browser": "^4.1.0", "@capacitor/browser": "^4.1.0",
"@capacitor/camera": "^4.1.4", "@capacitor/camera": "^4.1.4",
"@capacitor/core": "^3.3.2", "@capacitor/core": "^5.4.2",
"@capacitor/device": "^4.1.0", "@capacitor/device": "^4.1.0",
"@capacitor/filesystem": "^4.1.4", "@capacitor/filesystem": "^4.1.4",
"@capacitor/haptics": "^4.1.0", "@capacitor/haptics": "^4.1.0",
"@capacitor/ios": "^4.6.1", "@capacitor/ios": "^5.4.2",
"@capacitor/keyboard": "^4.1.0", "@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^4.1.4", "@capacitor/local-notifications": "^4.1.4",
"@capacitor/network": "^4.1.0", "@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^4.1.2", "@capacitor/push-notifications": "^5.1.0",
"@capacitor/share": "^4.1.0", "@capacitor/share": "^4.1.0",
"@capacitor/storage": "^1.2.5", "@capacitor/storage": "^1.2.5",
"@fortawesome/angular-fontawesome": "^0.9.0", "@fortawesome/angular-fontawesome": "^0.9.0",
@@ -182,6 +183,7 @@
"ts-jest-puppeteer": "^0.0.5", "ts-jest-puppeteer": "^0.0.5",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"uuidv4": "^6.2.11", "uuidv4": "^6.2.11",
"webpack": "^5.88.2",
"wordcloud": "^1.1.2", "wordcloud": "^1.1.2",
"ws": "^7.4.6", "ws": "^7.4.6",
"zod": "^3.22.2", "zod": "^3.22.2",
+23 -25
View File
@@ -164,8 +164,6 @@ export class HomePage implements OnInit {
this.logDeviceInfo(); this.logDeviceInfo();
this.notificationsService.onReciveForeground();
this.notificationsService.onReciveBackground();
window.addEventListener('online', () => { window.addEventListener('online', () => {
this.backgroundservice.online() this.backgroundservice.online()
@@ -238,20 +236,20 @@ export class HomePage implements OnInit {
}, 1000) }, 1000)
/* if (!this.platform.is('desktop')) { /* if (!this.platform.is('desktop')) {
App.addListener('appStateChange', ({ isActive }) => { App.addListener('appStateChange', ({ isActive }) => {
if (isActive) { if (isActive) {
// The app is in the foreground. // The app is in the foreground.
console.log('App is in the foreground'); console.log('App is in the foreground');
this.RochetChatConnectorService.connect() this.RochetChatConnectorService.connect()
this.reloadComponent(true) this.reloadComponent(true)
} else { } else {
// The app is in the background. // The app is in the background.
console.log('App is in the background'); console.log('App is in the background');
// You can perform actions specific to the background state here. // You can perform actions specific to the background state here.
} }
}); });
} */ } */
} }
@@ -344,15 +342,15 @@ export class HomePage implements OnInit {
} }
reloadComponent(self:boolean,urlToNavigateTo ?:string){ reloadComponent(self: boolean, urlToNavigateTo?: string) {
//skipLocationChange:true means dont update the url to / when navigating //skipLocationChange:true means dont update the url to / when navigating
console.log("Current route I am on:",this.router.url); console.log("Current route I am on:", this.router.url);
const url=self ? this.router.url :urlToNavigateTo; const url = self ? this.router.url : urlToNavigateTo;
this.router.navigateByUrl('/',{skipLocationChange:true}).then(()=>{ this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
this.router.navigate([`/${url}`]).then(()=>{ this.router.navigate([`/${url}`]).then(() => {
console.log(`After navigation I am on:${this.router.url}`) console.log(`After navigation I am on:${this.router.url}`)
}) })
}) })
} }
} }
+18 -18
View File
@@ -33,11 +33,11 @@ export class InactivityPage implements OnInit {
public alertController: AlertController, public alertController: AlertController,
public ThemeService: ThemeService, public ThemeService: ThemeService,
public p: PermissionService, public p: PermissionService,
) {} ) { }
loop = false loop = false
ngOnInit() {} ngOnInit() { }
runloop() { runloop() {
@@ -71,7 +71,7 @@ export class InactivityPage implements OnInit {
async Login() { async Login() {
if (this.validateUsername()) { if (this.validateUsername()) {
if(this.validatePassword()) { if (this.validatePassword()) {
this.userattempt = { this.userattempt = {
username: this.username, username: this.username,
@@ -79,7 +79,7 @@ export class InactivityPage implements OnInit {
domainName: environment.domain, domainName: environment.domain,
BasicAuthKey: "" BasicAuthKey: ""
} }
let attempt = await this.authService.login(this.userattempt, {saveSession: false}) let attempt = await this.authService.login(this.userattempt, { saveSession: false })
if (attempt) { if (attempt) {
@@ -88,7 +88,7 @@ export class InactivityPage implements OnInit {
if (attempt.UserId == SessionStore.user.UserId) { if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt); await this.authService.SetSession(attempt, this.userattempt);
if(this.p.userPermission(this.p.permissionList.Chat.access)){ if (this.p.userPermission(this.p.permissionList.Chat.access)) {
// this.authService.loginChat(); // this.authService.loginChat();
} }
@@ -119,18 +119,18 @@ export class InactivityPage implements OnInit {
getToken() { getToken() {
this.notificatinsservice.requestPermissions(); this.notificatinsservice.requestPermissions();
this.notificatinsservice.registrationError(); this.notificatinsservice.registrationError();
this.notificatinsservice.getAndpostToken(this.username); // this.notificatinsservice.getAndpostToken(this.username);
} }
setCode(code: string) { setCode(code: string) {
if(this.code.length < 4) { if (this.code.length < 4) {
this.code.push(code) this.code.push(code)
} }
if(this.code.length == 4) { if (this.code.length == 4) {
if(!SessionStore.hasPin) { if (!SessionStore.hasPin) {
// //
this.storePin() this.storePin()
this.pinLogin() this.pinLogin()
@@ -141,14 +141,14 @@ export class InactivityPage implements OnInit {
} }
clearCode() { clearCode() {
this.code =[] this.code = []
} }
pinLogin() { pinLogin() {
const code = this.code.join('') const code = this.code.join('')
if( SessionStore.validatePin(code)) { if (SessionStore.validatePin(code)) {
SessionStore.setInativity(true) SessionStore.setInativity(true)
this.goback() this.goback()
@@ -166,26 +166,26 @@ export class InactivityPage implements OnInit {
goback() { goback() {
const pathName = this.SessionStore.user.UrlBeforeInactivity const pathName = this.SessionStore.user.UrlBeforeInactivity
if(pathName) { if (pathName) {
this.router.navigate([pathName],{replaceUrl: true}); this.router.navigate([pathName], { replaceUrl: true });
} else { } else {
setTimeout(() => { setTimeout(() => {
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {
//When user has got access to Agenda but does not have their own calendar, goes to Agenda //When user has got access to Agenda but does not have their own calendar, goes to Agenda
if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {
this.router.navigate(['/home/agenda']); this.router.navigate(['/home/agenda']);
} }
else{ else {
this.router.navigate(['/home/events']); this.router.navigate(['/home/events']);
} }
} }
//If user has access permission to both Chat and Action, goes to Chat by default. //If user has access permission to both Chat and Action, goes to Chat by default.
else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ else if ((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)) {
this.router.navigate(['/home/chat']); this.router.navigate(['/home/chat']);
} }
else if(this.p.userPermission(this.p.permissionList.Actions.access)){ else if (this.p.userPermission(this.p.permissionList.Actions.access)) {
this.router.navigate(['/home/publications']); this.router.navigate(['/home/publications']);
} }
+20 -20
View File
@@ -34,7 +34,7 @@ export class LoginPage implements OnInit {
userattempt: UserForm; userattempt: UserForm;
code = [] code = []
hasPin: boolean hasPin: boolean
loginPreference: string loginPreference: string
sessionStore = SessionStore; sessionStore = SessionStore;
@@ -56,16 +56,16 @@ export class LoginPage implements OnInit {
private ChatService: ChatService, private ChatService: ChatService,
private platform: Platform, private platform: Platform,
private FirstEnterService: FirstEnterService, private FirstEnterService: FirstEnterService,
private storage:Storage, private storage: Storage,
private storageService: StorageService, private storageService: StorageService,
) {} ) { }
ngOnInit() {} ngOnInit() { }
togglePassword() { togglePassword() {
this.showPassword = !this.showPassword; this.showPassword = !this.showPassword;
if(this.passwordIcon == "eye") { if (this.passwordIcon == "eye") {
this.passwordIcon = "eye-off"; this.passwordIcon = "eye-off";
} else { } else {
this.passwordIcon = "eye"; this.passwordIcon = "eye";
@@ -101,14 +101,14 @@ export class LoginPage implements OnInit {
getToken() { getToken() {
this.notificatinsservice.requestPermissions(); this.notificatinsservice.requestPermissions();
this.notificatinsservice.registrationError(); this.notificatinsservice.registrationError();
this.notificatinsservice.getAndpostToken(this.username); // this.notificatinsservice.getAndpostToken(this.username);
} }
async Login() { async Login() {
if (this.validateUsername()) { if (this.validateUsername()) {
if(this.validatePassword()) { if (this.validatePassword()) {
this.userattempt = { this.userattempt = {
username: this.username.trim(), username: this.username.trim(),
@@ -119,8 +119,8 @@ export class LoginPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
let attempt = await this.authService.login(this.userattempt, {saveSession: false}) let attempt = await this.authService.login(this.userattempt, { saveSession: false })
const data = await this.authService.loginContenteProduction(this.userattempt, {saveSession: true}) const data = await this.authService.loginContenteProduction(this.userattempt, { saveSession: true })
loader.remove() loader.remove()
@@ -132,7 +132,7 @@ export class LoginPage implements OnInit {
CPSession.save(data) CPSession.save(data)
this.changeProfileService.run(); this.changeProfileService.run();
if(attempt.ChatData) { if (attempt.ChatData) {
await this.authService.loginToChatWs(); await this.authService.loginToChatWs();
this.ChatService.setheader() this.ChatService.setheader()
@@ -167,16 +167,16 @@ export class LoginPage implements OnInit {
if(attempt.ChatData) { if (attempt.ChatData) {
await this.authService.loginToChatWs(); await this.authService.loginToChatWs();
this.ChatService.setheader(); this.ChatService.setheader();
this.ChatSystemService.loadChat(); this.ChatSystemService.loadChat();
} }
this.storageService.remove("Notifications") this.storageService.remove("Notifications")
this.getToken(); this.getToken();
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) { if (!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
if(this.sessionStore.hasPin) { if (this.sessionStore.hasPin) {
this.router.navigateByUrl('/home/events'); this.router.navigateByUrl('/home/events');
} else { } else {
this.router.navigateByUrl('/pin', { replaceUrl: true }); this.router.navigateByUrl('/pin', { replaceUrl: true });
@@ -207,23 +207,23 @@ export class LoginPage implements OnInit {
goback() { goback() {
const pathName = SessionStore.user.UrlBeforeInactivity const pathName = SessionStore.user.UrlBeforeInactivity
if(pathName) { if (pathName) {
this.router.navigate([pathName]); this.router.navigate([pathName]);
} else { } else {
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {
//When user has got access to Agenda but does not have their own calendar, goes to Agenda //When user has got access to Agenda but does not have their own calendar, goes to Agenda
if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {
this.router.navigate(['/home/agenda']); this.router.navigate(['/home/agenda']);
} }
else{ else {
this.router.navigate(['/home/events']); this.router.navigate(['/home/events']);
} }
} }
//If user has access permission to both Chat and Action, goes to Chat by default. //If user has access permission to both Chat and Action, goes to Chat by default.
else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ else if ((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)) {
this.router.navigate(['/home/chat']); this.router.navigate(['/home/chat']);
} }
else if(this.p.userPermission(this.p.permissionList.Actions.access)){ else if (this.p.userPermission(this.p.permissionList.Actions.access)) {
this.router.navigate(['/home/publications']); this.router.navigate(['/home/publications']);
} }
} }
+44 -17
View File
@@ -15,6 +15,8 @@ import { Capacitor } from '@capacitor/core';
import { AngularFireMessaging } from '@angular/fire/messaging'; import { AngularFireMessaging } from '@angular/fire/messaging';
import { NotificationHolderService } from 'src/app/store/notification-holder.service'; import { NotificationHolderService } from 'src/app/store/notification-holder.service';
import { FCM } from '@capacitor-community/fcm';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -51,6 +53,9 @@ export class NotificationsService {
private afMessaging: AngularFireMessaging, private afMessaging: AngularFireMessaging,
public NotificationHolderService: NotificationHolderService) { public NotificationHolderService: NotificationHolderService) {
this.onReciveForeground();
this.onReciveBackground();
} }
getTokenByUserIdAndId(user, userID) { getTokenByUserIdAndId(user, userID) {
@@ -65,10 +70,11 @@ export class NotificationsService {
if (!this.isPushNotificationsAvailable) { if (!this.isPushNotificationsAvailable) {
return false return false
} }
PushNotifications.requestPermissions().then(result => { PushNotifications.requestPermissions().then(async (result) => {
if (result.receive === 'granted') { if (result.receive === 'granted') {
// Register with Apple / Google to receive push via APNS/FCM // Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register(); PushNotifications.register();
this.getAndpostToken("")
} else { } else {
// Show some error // Show some error
} }
@@ -77,19 +83,31 @@ export class NotificationsService {
} }
} }
getAndpostToken(username) { private getAndpostToken(username) {
const geturl = environment.apiURL + 'notifications/token'; const geturl = environment.apiURL + 'notifications/token';
if (this.platform.is('mobile')) { if (this.platform.is('mobile')) {
if (!this.isPushNotificationsAvailable) { if (!this.isPushNotificationsAvailable) {
return false return false
} }
if (this.platform.is('ios')) {
FCM.getToken()
.then(r => {
this.postToken(r.token, geturl)
this.token = r.token
// alert(this.token)
})
.catch(err => console.log(err));
} else {
PushNotifications.addListener('registration',
(token: Token) => {
this.postToken(token.value, geturl)
this.token = token.value
}
);
}
PushNotifications.addListener('registration',
(token: Token) => {
this.postToken(token.value, geturl)
this.token = token.value
}
);
} else { } else {
this.afMessaging.requestToken.subscribe( this.afMessaging.requestToken.subscribe(
(token) => { (token) => {
@@ -103,7 +121,6 @@ export class NotificationsService {
} }
); );
} }
} }
@@ -148,14 +165,18 @@ export class NotificationsService {
PushNotifications.addListener('registrationError', PushNotifications.addListener('registrationError',
(error: any) => { (error: any) => {
this.active = false this.active = false;
(() => {
throw ("error" + error.error)
})();
} }
); );
} }
onReciveForeground() { onReciveForeground() {
if(this.platform.is('mobile')) { if (this.platform.is('mobile')) {
if (!this.isPushNotificationsAvailable) { if (!this.isPushNotificationsAvailable) {
return false return false
@@ -174,9 +195,9 @@ export class NotificationsService {
this.afMessaging.messages.subscribe((notification) => { this.afMessaging.messages.subscribe((notification) => {
this.storenotification(notification) this.storenotification(notification)
this.notificationReceived.emit(); this.notificationReceived.emit();
this.eventtrigger.publishSomeData({ this.eventtrigger.publishSomeData({
notification: "recive" notification: "recive"
}) })
// Handle the received message, e.g., show a notification // Handle the received message, e.g., show a notification
}); });
} }
@@ -190,7 +211,7 @@ export class NotificationsService {
onReciveBackground() { onReciveBackground() {
if(this.platform.is('mobile')) { if (this.platform.is('mobile')) {
if (!this.isPushNotificationsAvailable) { if (!this.isPushNotificationsAvailable) {
return false return false
} }
@@ -285,7 +306,7 @@ export class NotificationsService {
notificatinsRoutes = (notification) => { notificatinsRoutes = (notification) => {
console.log('BACK BACK',notification) console.log('BACK BACK', notification)
if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) {
@@ -336,8 +357,14 @@ export class NotificationsService {
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital']));
} else if (notification.notification.data.Service === "chat") { } else if (notification.notification.data.Service === "chat") {
let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } }; let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } };
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
this.zone.run(() => this.router.navigate(['/home/chat']));
setTimeout(() => {
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
}, 200);
} }
} }
File diff suppressed because one or more lines are too long