Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove Push Notification feature #2935

Merged
merged 12 commits into from
May 8, 2024
4 changes: 0 additions & 4 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
"pkg": "@capacitor/preferences",
"classpath": "com.capacitorjs.plugins.preferences.PreferencesPlugin"
},
{
"pkg": "@capacitor/push-notifications",
"classpath": "com.capacitorjs.plugins.pushnotifications.PushNotificationsPlugin"
},
{
"pkg": "@capacitor/splash-screen",
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
Expand Down
3 changes: 0 additions & 3 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ project(':capacitor-network').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-preferences'
project(':capacitor-preferences').projectDir = new File('../node_modules/@capacitor/preferences/android')

include ':capacitor-push-notifications'
project(':capacitor-push-notifications').projectDir = new File('../node_modules/@capacitor/push-notifications/android')

include ':capacitor-splash-screen'
project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android')

Expand Down
1 change: 0 additions & 1 deletion android/variables.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ext {
androidxMaterialVersion = '1.6.1'
androidxBrowserVersion = '1.4.0'
androidxExifInterfaceVersion = '1.3.3'
firebaseMessagingVersion = '23.0.5'
playServicesLocationVersion = '20.0.0'
junitVersion = '4.13.2'
androidxJunitVersion = '1.1.3'
Expand Down
1 change: 0 additions & 1 deletion hooks/utils/google-credentials-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports.getGoogleCredentialsAndroid = (NATIVE_CONFIG) => `
{
"project_info": {
"project_number": "${process.env.FYLE_MOBILE_PROJECT_NUMBER}",
"firebase_url": "${process.env.FYLE_MOBILE_FIREBASE_URL}",
"project_id": "${process.env.FYLE_MOBILE_PROJECT_ID}",
"storage_bucket": "${process.env.FYLE_MOBILE_STORAGE_BUCKET}"
},
Expand Down
2 changes: 0 additions & 2 deletions hooks/utils/google-credentials-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ module.exports.getGoogleCredentialsIos = (NATIVE_CONFIG) =>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>${process.env.FYLE_MOBILE_IOS_GOOGLE_APP_ID}</string>
<key>DATABASE_URL</key>
<string>${process.env.FYLE_MOBILE_FIREBASE_URL}</string>
</dict>
</plist>
`
26 changes: 0 additions & 26 deletions ios/App/App/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import UIKit
import Capacitor
import FirebaseCore
import FirebaseInstanceID
import FirebaseMessaging

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
Expand Down Expand Up @@ -68,22 +58,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// tracking app url opens, make sure to keep this call
return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
}


func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().token(completion: { (token, error) in
if let error = error {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
} else if let token = token {
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
}
})
}

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
}
}


3 changes: 0 additions & 3 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def capacitor_pods
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'
pod 'CapacitorPreferences', :path => '../../node_modules/@capacitor/preferences'
pod 'CapacitorPushNotifications', :path => '../../node_modules/@capacitor/push-notifications'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapacitorTextZoom', :path => '../../node_modules/@capacitor/text-zoom'
Expand All @@ -35,8 +34,6 @@ end
target 'App' do
capacitor_pods
# Add your Pods here
pod 'FirebaseCore'
pod 'Firebase/Messaging'
end


Expand Down
15 changes: 0 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@capacitor/keyboard": "^4.1.0",
"@capacitor/network": "^4.1.0",
"@capacitor/preferences": "^4.0.2",
"@capacitor/push-notifications": "^4.1.2",
"@capacitor/splash-screen": "^4.1.2",
"@capacitor/status-bar": "^4.1.1",
"@capacitor/text-zoom": "^4.1.0",
Expand Down
15 changes: 5 additions & 10 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
import { UserEventService } from 'src/app/core/services/user-event.service';
import { DeviceService } from 'src/app/core/services/device.service';
import { AppVersionService } from './core/services/app-version.service';
import { environment } from 'src/environments/environment';
import { RouterAuthService } from './core/services/router-auth.service';
import { NetworkService } from './core/services/network.service';
import { App } from '@capacitor/app';
import { StatusBar, Style } from '@capacitor/status-bar';
import { SplashScreen } from '@capacitor/splash-screen';
import { FreshChatService } from './core/services/fresh-chat.service';
import { DeepLinkService } from './core/services/deep-link.service';
import { PushNotificationService } from './core/services/push-notification.service';
import { TrackingService } from './core/services/tracking.service';
import { LoginInfoService } from './core/services/login-info.service';
import { SidemenuComponent } from './shared/components/sidemenu/sidemenu.component';
Expand Down Expand Up @@ -66,7 +64,6 @@
private freshChatService: FreshChatService,
private zone: NgZone,
private deepLinkService: DeepLinkService,
private pushNotificationService: PushNotificationService,
private trackingService: TrackingService,
private loginInfoService: LoginInfoService,
private navController: NavController,
Expand All @@ -77,7 +74,7 @@
this.registerBackButtonAction();
}

registerBackButtonAction() {
registerBackButtonAction(): void {
this.platform.backButton.subscribeWithPriority(BackButtonActionPriority.LOW, () => {
if (this.router.url.includes('sign_in')) {
this.backButtonService.showAppCloseAlert();
Expand All @@ -93,7 +90,7 @@
});
}

initializeApp() {
initializeApp(): void {
// eslint-disable-next-line max-len
// Sample url - "https://fyle.app.link/branchio_redirect?redirect_uri=https%3A%2F%2Fstaging.fylehq.ninja%2Fapp%2Fmain%2F%23%2Fenterprise%2Freports%2Frpsv8oKuAfGe&org_id=orrjqbDbeP9p"

Expand Down Expand Up @@ -139,22 +136,22 @@
});
}

setupNetworkWatcher() {
setupNetworkWatcher(): void {
const networkWatcherEmitter = new EventEmitter<boolean>();
this.networkService.connectivityWatcher(networkWatcherEmitter);
this.isConnected$ = concat(this.networkService.isOnline(), networkWatcherEmitter.asObservable()).pipe(
shareReplay(1)
);
}

ngOnInit() {
ngOnInit(): void {
this.setupNetworkWatcher();

if ((window as any) && (window as any).localStorage) {

Check failure on line 150 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type

Check failure on line 150 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe member access .localStorage on an `any` value

Check failure on line 150 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type
const lstorage = (window as any).localStorage;

Check failure on line 151 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe assignment of an `any` value

Check failure on line 151 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe member access .localStorage on an `any` value

Check failure on line 151 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type
Object.keys(lstorage)

Check failure on line 152 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe argument of type `any` assigned to a parameter of type `{}`
.filter((key) => key.match(/^fyle/))
.forEach((key) => lstorage.removeItem(key));

Check failure on line 154 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe return of an `any` typed value

Check failure on line 154 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe member access .removeItem on an `any` value

Check failure on line 154 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unsafe call of an `any` typed value
}

this.isConnected$.subscribe((isOnline) => {
Expand All @@ -169,8 +166,6 @@
} else {
this.sidemenuRef.showSideMenuOffline();
}

this.pushNotificationService.initPush();
}

const markOptions: PerformanceMarkOptions = {
Expand Down Expand Up @@ -221,7 +216,7 @@
this.gmapsService.loadLibrary();
}

switchDelegator(isSwitchedToDelegator: boolean) {
switchDelegator(isSwitchedToDelegator: boolean): void {
this.isSwitchedToDelegator = isSwitchedToDelegator;
}
}
15 changes: 0 additions & 15 deletions src/app/auth/sign-in/sign-in.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { LoaderService } from 'src/app/core/services/loader.service';
import { AuthService } from 'src/app/core/services/auth.service';
import { GoogleAuthService } from 'src/app/core/services/google-auth.service';
import { InAppBrowser } from '@awesome-cordova-plugins/in-app-browser/ngx';
import { PushNotificationService } from 'src/app/core/services/push-notification.service';
import { TrackingService } from '../../core/services/tracking.service';
import { DeviceService } from '../../core/services/device.service';
import { LoginInfoService } from '../../core/services/login-info.service';
Expand Down Expand Up @@ -41,7 +40,6 @@ describe('SignInPage', () => {
let activatedRoute: jasmine.SpyObj<ActivatedRoute>;
let googleAuthService: jasmine.SpyObj<GoogleAuthService>;
let inAppBrowser: jasmine.SpyObj<InAppBrowser>;
let pushNotificationService: jasmine.SpyObj<PushNotificationService>;
let trackingService: jasmine.SpyObj<TrackingService>;
let deviceService: jasmine.SpyObj<DeviceService>;
let loginInfoService: jasmine.SpyObj<LoginInfoService>;
Expand All @@ -61,7 +59,6 @@ describe('SignInPage', () => {
const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
const googleAuthServiceSpy = jasmine.createSpyObj('GoogleAuthService', ['login']);
const inAppBrowserSpy = jasmine.createSpyObj('InAppBrowser', ['create']);
const pushNotificationServiceSpy = jasmine.createSpyObj('PushNotificationService', ['initPush']);
const trackingServiceSpy = jasmine.createSpyObj('TrackingService', ['onSignin', 'eventTrack']);
const deviceServiceSpy = jasmine.createSpyObj('DeviceService', ['getDeviceInfo']);
const loginInfoServiceSpy = jasmine.createSpyObj('LoginInfoService', ['addLoginInfo']);
Expand Down Expand Up @@ -114,10 +111,6 @@ describe('SignInPage', () => {
provide: InAppBrowser,
useValue: inAppBrowserSpy,
},
{
provide: PushNotificationService,
useValue: pushNotificationServiceSpy,
},
{
provide: TrackingService,
useValue: trackingServiceSpy,
Expand Down Expand Up @@ -149,7 +142,6 @@ describe('SignInPage', () => {
activatedRoute = TestBed.inject(ActivatedRoute) as jasmine.SpyObj<ActivatedRoute>;
googleAuthService = TestBed.inject(GoogleAuthService) as jasmine.SpyObj<GoogleAuthService>;
inAppBrowser = TestBed.inject(InAppBrowser) as jasmine.SpyObj<InAppBrowser>;
pushNotificationService = TestBed.inject(PushNotificationService) as jasmine.SpyObj<PushNotificationService>;
trackingService = TestBed.inject(TrackingService) as jasmine.SpyObj<TrackingService>;
deviceService = TestBed.inject(DeviceService) as jasmine.SpyObj<DeviceService>;
loginInfoService = TestBed.inject(LoginInfoService) as jasmine.SpyObj<LoginInfoService>;
Expand Down Expand Up @@ -191,7 +183,6 @@ describe('SignInPage', () => {
it('should check saml response and sign in user', async () => {
routerAuthService.handleSignInResponse.and.returnValue(Promise.resolve(authResData1));
spyOn(component, 'trackLoginInfo');
pushNotificationService.initPush.and.callThrough();
router.navigate.and.returnValue(Promise.resolve(true));
authService.refreshEou.and.returnValue(of(apiEouRes));

Expand All @@ -203,7 +194,6 @@ describe('SignInPage', () => {
expect(routerAuthService.handleSignInResponse).toHaveBeenCalledOnceWith(samlResData1);
expect(authService.refreshEou).toHaveBeenCalledTimes(1);
expect(component.trackLoginInfo).toHaveBeenCalledTimes(1);
expect(pushNotificationService.initPush).toHaveBeenCalledTimes(1);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'auth', 'switch_org', { choose: true }]);
});

Expand Down Expand Up @@ -361,7 +351,6 @@ describe('SignInPage', () => {
routerAuthService.basicSignin.and.returnValue(of(authResData1));
authService.refreshEou.and.returnValue(of(apiEouRes));
trackingService.onSignin.and.callThrough();
pushNotificationService.initPush.and.callThrough();
router.navigate.and.returnValue(Promise.resolve(true));
component.fg.controls.password.setValue('password');
component.fg.controls.email.setValue('email');
Expand All @@ -374,7 +363,6 @@ describe('SignInPage', () => {
expect(trackingService.onSignin).toHaveBeenCalledOnceWith('email', {
label: 'Email',
});
expect(pushNotificationService.initPush).toHaveBeenCalledTimes(1);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'auth', 'switch_org', { choose: true }]);
});

Expand All @@ -384,7 +372,6 @@ describe('SignInPage', () => {
routerAuthService.basicSignin.and.returnValue(throwError(() => new HttpErrorResponse({ error: 'error' })));
authService.refreshEou.and.returnValue(of(apiEouRes));
trackingService.onSignin.and.callThrough();
pushNotificationService.initPush.and.callThrough();
router.navigate.and.returnValue(Promise.resolve(true));
spyOn(component, 'handleError');
fixture.detectChanges();
Expand Down Expand Up @@ -416,7 +403,6 @@ describe('SignInPage', () => {
loaderService.hideLoader.and.returnValue(Promise.resolve());
routerAuthService.googleSignin.and.returnValue(of(authResData2));
trackingService.onSignin.and.callThrough();
pushNotificationService.initPush.and.callThrough();
router.navigate.and.returnValue(Promise.resolve(true));
authService.refreshEou.and.returnValue(of(apiEouRes));

Expand All @@ -430,7 +416,6 @@ describe('SignInPage', () => {
expect(trackingService.onSignin).toHaveBeenCalledOnceWith('[email protected]', {
label: 'Email',
});
expect(pushNotificationService.initPush).toHaveBeenCalledTimes(1);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'auth', 'switch_org', { choose: true }]);
expect(component.trackLoginInfo).toHaveBeenCalledTimes(1);
});
Expand Down
5 changes: 0 additions & 5 deletions src/app/auth/sign-in/sign-in.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { LoaderService } from 'src/app/core/services/loader.service';
import { AuthService } from 'src/app/core/services/auth.service';
import { Router, ActivatedRoute } from '@angular/router';
import { GoogleAuthService } from 'src/app/core/services/google-auth.service';
import { PushNotificationService } from 'src/app/core/services/push-notification.service';
import { TrackingService } from '../../core/services/tracking.service';
import { DeviceService } from '../../core/services/device.service';
import { LoginInfoService } from '../../core/services/login-info.service';
Expand Down Expand Up @@ -47,7 +46,6 @@ export class SignInPage implements OnInit {
private router: Router,
private activatedRoute: ActivatedRoute,
public googleAuthService: GoogleAuthService,
private pushNotificationService: PushNotificationService,
private trackingService: TrackingService,
private deviceService: DeviceService,
private loginInfoService: LoginInfoService,
Expand Down Expand Up @@ -79,7 +77,6 @@ export class SignInPage implements OnInit {
})
)
.subscribe(() => {
this.pushNotificationService.initPush();
this.fg.reset();
this.router.navigate(['/', 'auth', 'switch_org', { choose: true }]);
});
Expand Down Expand Up @@ -196,7 +193,6 @@ export class SignInPage implements OnInit {
)
.subscribe({
next: () => {
this.pushNotificationService.initPush();
this.fg.reset();
this.router.navigate(['/', 'auth', 'switch_org', { choose: true }]);
},
Expand Down Expand Up @@ -244,7 +240,6 @@ export class SignInPage implements OnInit {
)
.subscribe({
next: () => {
this.pushNotificationService.initPush();
this.fg.reset();
this.router.navigate(['/', 'auth', 'switch_org', { choose: true }]);
},
Expand Down
Loading
Loading