Skip to content

Commit

Permalink
Revert logs (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew2564 authored Mar 10, 2023
1 parent 0ba6819 commit 00c9a53
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 73 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="uk.gov.dvsa.drivingexaminerservices" version="4.7.2.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="uk.gov.dvsa.drivingexaminerservices" version="4.7.2.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>DES</name>
<description>An application for DVSA driving examiners to conduct driving tests digitally</description>
<content src="index.html" />
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.7.2.5</string>
<string>4.7.2.6</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4.7.2.5</string>
<string>4.7.2.6</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down
1 change: 0 additions & 1 deletion ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCommunityMdmAppconfig', :path => '../../node_modules/@capacitor-community/mdm-appconfig'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapawesomeCapacitorManagedConfigurations', :path => '../../node_modules/@capawesome/capacitor-managed-configurations'
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 @@ -60,7 +60,6 @@
"@awesome-cordova-plugins/network": "^6.2.0",
"@awesome-cordova-plugins/screen-orientation": "^6.2.0",
"@awesome-cordova-plugins/secure-storage": "^6.2.0",
"@capacitor-community/mdm-appconfig": "^4.0.5",
"@capacitor/cli": "^4.4.0",
"@capacitor/core": "^4.4.0",
"@capacitor/ios": "^4.4.0",
Expand Down
5 changes: 0 additions & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,10 @@ export class AppComponent extends LogoutBasePageComponent implements OnInit {

async ngOnInit() {
try {
alert('TESTING - Initialisation');
await this.platform.ready();
alert('TESTING - Ready');
if (this.platform.is('cordova')) {
alert('TESTING - Is running on a cordova device');
await this.deviceProvider.disableSingleAppMode();
}
alert('TESTING - Is about to attempt initialiseAppConfig via AppComponent');
await this.appConfigProvider.initialiseAppConfig();
await this.initialiseSentry();
this.initialiseNetworkState();
Expand All @@ -82,7 +78,6 @@ export class AppComponent extends LogoutBasePageComponent implements OnInit {
await this.disableMenuSwipe();
this.logoutEnabled$ = this.store$.select(selectLogoutEnabled);
} catch {
alert('TESTING - AppComponent catch thrown');
await this.router.navigate([LOGIN_PAGE], { replaceUrl: true });
}
}
Expand Down
14 changes: 0 additions & 14 deletions src/app/pages/login/login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class LoginPage extends LogoutBasePageComponent implements OnInit {

// Trigger Authentication if ios device
if (!this.hasUserLoggedOut && this.isIos()) {
alert('Login - Initialisation');
await this.login();
}

Expand All @@ -96,34 +95,21 @@ export class LoginPage extends LogoutBasePageComponent implements OnInit {
}

login = async (): Promise<any> => {
alert('Login - called');

await this.handleLoadingUI(true);

try {
await this.platform.ready();
this.appConfigProvider.logInfo('LoginPage - plat ready');

this.store$.dispatch(StartSendingLogs());

this.appConfigProvider.logInfo('LoginPage - StartSendingLogs');

await this.appConfigProvider.initialiseAppConfig();

this.appConfigProvider.logInfo('LoginPage - StartSendingLogs');

this.appInitializedLog();

this.appConfigProvider.logInfo('LoginPage - appInitializedLog');

this.initialiseAuthentication();

this.appConfigProvider.logInfo('LoginPage - initialiseAuthentication');

await this.authenticationProvider.expireTokens();

this.appConfigProvider.logInfo('LoginPage - expireTokens');

const isAuthenticated = await this.authenticationProvider.isAuthenticated();

await this.hideSplashscreen();
Expand Down
35 changes: 1 addition & 34 deletions src/app/providers/app-config/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { map, timeout } from 'rxjs/operators';
import { isEmpty, merge } from 'lodash';
import { ValidatorResult, ValidationError } from 'jsonschema';
import { IsDebug } from '@awesome-cordova-plugins/is-debug/ngx';
import { AppConfig as MDMAppConfig } from '@capacitor-community/mdm-appconfig';
import { GetResult, ManagedConfigurations } from '@capawesome/capacitor-managed-configurations';
import { Subscription } from 'rxjs';

Expand Down Expand Up @@ -79,24 +78,15 @@ export class AppConfigProvider {

public initialiseAppConfig = async (): Promise<void> => {
try {
this.logInfo('initialiseAppConfig called');
if (this.platform.is('cordova')) {
this.logInfo('is cordova');
await this.getDebugMode();
this.logInfo('getDebugMode');
await this.loadManagedConfig();
this.logInfo('loadManagedConfig');
}

this.logInfo('start mapInAppConfig');
this.mapInAppConfig(this.environmentFile);
this.logInfo('finish mapInAppConfig');

this.logInfo('start this.environmentFile.isRemote');
if (!this.environmentFile.isRemote) {
this.logInfo('!this.environmentFile.isRemote');
this.mapRemoteConfig(this.environmentFile);
this.logInfo('mapRemoteConfig');
}
return await Promise.resolve();
} catch (err) {
Expand Down Expand Up @@ -125,15 +115,6 @@ export class AppConfigProvider {
};

public loadManagedConfig = async (): Promise<void> => {
this.logInfo('start loadManagedConfig');
const val = await MDMAppConfig
.getValue({ key: 'configUrl' })
.catch((error) => {
alert(`MDMAppConfig getValue: ${error}`);
return error;
});
this.logInfo(`new plugin configUrl: ${val}`);

const newEnvFile = {
production: false,
isRemote: true,
Expand All @@ -158,28 +139,20 @@ export class AppConfigProvider {
},
} as EnvironmentFile;

this.logInfo(`start newEnvFile.configUrl: ${newEnvFile.configUrl}`);
this.logInfo(JSON.stringify(newEnvFile));
// Check to see if we have any config
if (!isEmpty((newEnvFile.configUrl))) {
this.environmentFile = { ...newEnvFile };
return;
}

this.logInfo('loadManagedConfig check debug', !this.isDebugMode);

if (!this.isDebugMode) {
this.logInfo('throwing AppConfigError');
throw new Error(AppConfigError.MISSING_REMOTE_CONFIG_URL_ERROR);
}

this.logInfo('loadManagedConfig debug not thrown');
};

private getManagedConfigValueString = async (key: string): Promise<string> => {
try {
const data: GetResult<string> = await ManagedConfigurations.getString({ key });
alert(`key: ${key}, value: ${data.value}`);
return data?.value;
} catch (err) {
this.logError(`getManagedConfigValueString - ${key}`, err);
Expand Down Expand Up @@ -269,14 +242,12 @@ export class AppConfigProvider {
};

private logError = (description: string, error: string): void => {
alert(`ERROR: ${description}`);
this.store$.dispatch(SaveLog({
payload: this.logHelper.createLog(LogType.ERROR, description, error),
}));
};

public logInfo = (description: string, value: any = ''): void => {
alert(description);
this.store$.dispatch(SaveLog({
payload: this.logHelper.createLog(LogType.INFO, description, value),
}));
Expand All @@ -292,7 +263,6 @@ export class AppConfigProvider {
};

private mapInAppConfig = (data) => {
this.logInfo('mapInAppConfig');
this.appConfig = merge({}, this.appConfig, {
configUrl: data.configUrl,
sentry: {
Expand All @@ -313,11 +283,9 @@ export class AppConfigProvider {
employeeIdKey: data.authentication.employeeIdKey,
},
} as AppConfig);
this.logInfo('mapInAppConfig', this.appConfig);
};

private mapRemoteConfig = (data: any) => {
this.logInfo('mapRemoteConfig');
this.appConfig = merge({}, this.appConfig, {
googleAnalyticsId: data.googleAnalyticsId,
approvedDeviceIdentifiers: data.approvedDeviceIdentifiers,
Expand Down Expand Up @@ -361,15 +329,14 @@ export class AppConfigProvider {
},
requestTimeout: data.requestTimeout,
} as AppConfig);
this.logInfo('mapRemoteConfig', this.appConfig);
};

getDebugMode = (): Promise<void> => {
return new Promise((resolve, reject) => {
this.isDebug.getIsDebug()
.then((isDebug) => {
this.isDebugMode = (environment as unknown as TestersEnvironmentFile)?.isTest ? true : isDebug;
this.logInfo(`Detected that app is running in debug mode: ${this.isDebugMode}`);
console.log('Detected that app is running in debug mode');
resolve();
})
.catch((err) => reject(err));
Expand Down

0 comments on commit 00c9a53

Please sign in to comment.