Skip to content

Commit

Permalink
Merge pull request #1 from ChristopherLinnett/refactor-arrays-to-objects
Browse files Browse the repository at this point in the history
Refactor arrays to objects
  • Loading branch information
ChristopherLinnett authored Jun 13, 2022
2 parents f82c3a9 + f047b5f commit 14c246a
Show file tree
Hide file tree
Showing 228 changed files with 2,171 additions and 942 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ApneaElearning 2701ICT Griffith University

This application was created as an assessment piece for Griffith University, Interactive Application Development Course.
This is my first application created using a combination of Ionic/Angular.

This was a great learning experience, while the final application is functional as intended there were ways I could have simplified the process.

Data Typing, My data was stored in arrays, initially this was not an issue. But when it came time for deleting and recalculating indexes combined with async functions, managing this data became difficult.
My fix was to change from using arrays to mapping key:value pairs for each user, using string interpolation to read/write to individual users.

Data Structuring, The data is stored in JSON within a user file and all permissions/courses etc are built into this. Initially I wanted to use a relational database but had not encountered solutions for this yet.
The solution I thought better to implement would work the same way as a relational database, and modelled in the same way. With each Database table as one key:value pair with the data stored as objects as changed earlier.

Starting with these two options initially would have made for much easier, creation/reading/updating/deleting of all the data and encountering these problems here has given positive insights for future projects.
This has taught me the value of utilising proper planning with UML(or equivelant) diagrams before starting the coding process, and wireframing before even starting the coding process.
Doing this will cut down on the required time to code the project, and increase planning time allowing for a much smoother end product with likely less bugs to fix along the way
8 changes: 8 additions & 0 deletions android/.idea/misc.xml

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

1 change: 1 addition & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies {
implementation project(':capacitor-filesystem')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-splash-screen')
implementation project(':capacitor-status-bar')
implementation project(':capacitor-storage')

Expand Down
19 changes: 18 additions & 1 deletion android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,22 @@
"appId": "com.linnettchristopher.apneaelearning",
"appName": "ApneaElearning",
"webDir": "www",
"bundledWebRuntime": false
"bundledWebRuntime": false,
"plugins": {
"SplashScreen": {
"launchShowDuration": 3000,
"launchAutoHide": true,
"backgroundColor": "#ffffffff",
"androidSplashResourceName": "splash",
"androidScaleType": "CENTER_CROP",
"showSpinner": true,
"androidSpinnerStyle": "large",
"iosSpinnerStyle": "small",
"spinnerColor": "#999999",
"splashFullScreen": true,
"splashImmersive": true,
"layoutName": "launch_screen",
"useDialog": true
}
}
}
4 changes: 4 additions & 0 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"pkg": "@capacitor/keyboard",
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
},
{
"pkg": "@capacitor/splash-screen",
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
},
{
"pkg": "@capacitor/status-bar",
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
Expand Down
Binary file modified android/app/src/main/res/drawable-land-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-land-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-land-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-land-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-land-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-port-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-port-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-port-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-port-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-port-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
3 changes: 3 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')

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

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

Expand Down
19 changes: 18 additions & 1 deletion capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ const config: CapacitorConfig = {
appId: 'com.linnettchristopher.apneaelearning',
appName: 'ApneaElearning',
webDir: 'www',
bundledWebRuntime: false
bundledWebRuntime: false,
plugins: {
SplashScreen: {
launchShowDuration: 3000,
launchAutoHide: true,
backgroundColor: "#ffffffff",
androidSplashResourceName: "splash",
androidScaleType: "CENTER_CROP",
showSpinner: true,
androidSpinnerStyle: "large",
iosSpinnerStyle: "small",
spinnerColor: "#999999",
splashFullScreen: true,
splashImmersive: true,
layoutName: "launch_screen",
useDialog: true,
},
},
};

export default config;
Binary file modified ios/App/App/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/App/App/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png
Binary file modified ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png
Binary file modified ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png
15 changes: 8 additions & 7 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage'
pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app'
pod 'CapacitorCamera', :path => '..\..\node_modules\@capacitor\camera'
pod 'CapacitorFilesystem', :path => '..\..\node_modules\@capacitor\filesystem'
pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics'
pod 'CapacitorKeyboard', :path => '..\..\node_modules\@capacitor\keyboard'
pod 'CapacitorSplashScreen', :path => '..\..\node_modules\@capacitor\splash-screen'
pod 'CapacitorStatusBar', :path => '..\..\node_modules\@capacitor\status-bar'
pod 'CapacitorStorage', :path => '..\..\node_modules\@capacitor\storage'
end

target 'App' do
Expand Down
15 changes: 15 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@capacitor/haptics": "1.1.4",
"@capacitor/ios": "3.5.0",
"@capacitor/keyboard": "1.2.2",
"@capacitor/splash-screen": "^1.2.2",
"@capacitor/status-bar": "1.0.8",
"@capacitor/storage": "^1.2.5",
"@ionic/angular": "^6.0.0",
Expand Down
Binary file added resources/android/icon-background.png
Binary file added resources/android/icon-foreground.png
Binary file added resources/android/icon/drawable-hdpi-icon.png
Binary file added resources/android/icon/drawable-ldpi-icon.png
Binary file added resources/android/icon/drawable-mdpi-icon.png
Binary file added resources/android/icon/drawable-xhdpi-icon.png
Binary file added resources/android/icon/drawable-xxhdpi-icon.png
Binary file added resources/android/icon/drawable-xxxhdpi-icon.png
Binary file added resources/android/icon/hdpi-background.png
Binary file added resources/android/icon/hdpi-foreground.png
Binary file added resources/android/icon/ldpi-background.png
Binary file added resources/android/icon/ldpi-foreground.png
Binary file added resources/android/icon/mdpi-background.png
Binary file added resources/android/icon/mdpi-foreground.png
Binary file added resources/android/icon/xhdpi-background.png
Binary file added resources/android/icon/xhdpi-foreground.png
Binary file added resources/android/icon/xxhdpi-background.png
Binary file added resources/android/icon/xxhdpi-foreground.png
Binary file added resources/android/icon/xxxhdpi-background.png
Binary file added resources/android/icon/xxxhdpi-foreground.png
Binary file added resources/icon.png
Binary file added resources/ios/icon/icon-1024.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-20.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-29.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-40.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-50.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-60.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-72.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon-76.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/icon/icon.png
Binary file added resources/ios/icon/[email protected]
Binary file added resources/ios/splash/Default-1792h~iphone.png
Binary file added resources/ios/splash/Default-2436h.png
Binary file added resources/ios/splash/Default-2688h~iphone.png
Binary file added resources/ios/splash/Default-568h@2x~iphone.png
Binary file added resources/ios/splash/Default-667h.png
Binary file added resources/ios/splash/Default-736h.png
Binary file added resources/ios/splash/Default-Landscape-2436h.png
Binary file added resources/ios/splash/Default-Landscape-736h.png
Binary file added resources/ios/splash/Default-Landscape~ipad.png
Binary file added resources/ios/splash/Default-Portrait@2x~ipad.png
Binary file added resources/ios/splash/Default-Portrait~ipad.png
Binary file added resources/ios/splash/Default@2x~iphone.png
Binary file added resources/ios/splash/Default~iphone.png
Binary file added resources/splash.png
Binary file added resources/windows/icon/SmallTile.scale-100.png
Binary file added resources/windows/icon/SmallTile.scale-125.png
Binary file added resources/windows/icon/SmallTile.scale-140.png
Binary file added resources/windows/icon/SmallTile.scale-150.png
Binary file added resources/windows/icon/SmallTile.scale-200.png
Binary file added resources/windows/icon/SmallTile.scale-240.png
Binary file added resources/windows/icon/SmallTile.scale-400.png
Binary file added resources/windows/icon/StoreLogo.scale-100.png
Binary file added resources/windows/icon/StoreLogo.scale-125.png
Binary file added resources/windows/icon/StoreLogo.scale-140.png
Binary file added resources/windows/icon/StoreLogo.scale-150.png
Binary file added resources/windows/icon/StoreLogo.scale-180.png
Binary file added resources/windows/icon/StoreLogo.scale-200.png
Binary file added resources/windows/icon/StoreLogo.scale-240.png
Binary file added resources/windows/icon/StoreLogo.scale-400.png
Binary file added resources/windows/splash/Splash.scale-100.png
Binary file added resources/windows/splash/Splash.scale-125.png
Binary file added resources/windows/splash/Splash.scale-150.png
Binary file added resources/windows/splash/Splash.scale-200.png
Binary file added resources/windows/splash/Splash.scale-400.png
5 changes: 0 additions & 5 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ const routes: Routes = [
loadChildren: () =>
import('./users/login/login.module').then((m) => m.LoginPageModule),
},
{
path: 'quizlanding',
loadChildren: () =>
import('./quiz/landing/landing.module').then((m) => m.LandingPageModule),
},
{
path: 'in-progress',
loadChildren: () =>
Expand Down
12 changes: 10 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Component, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { LoginPage } from './users/login/login.page';
import { UserService } from './users/user.service';
import { SplashScreen } from '@capacitor/splash-screen';

@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
Expand All @@ -13,7 +15,13 @@ export class AppComponent implements OnInit {
private userService: UserService
) {}

ngOnInit(): void {
}
/**
* Show the splash screen, and hide it automatically when the app is ready.
*/
async ngOnInit(): Promise<void> {
await SplashScreen.show({
autoHide: true
});
}

}
13 changes: 10 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { DetailContentPage } from './content/detail-content/detail-content.page';
import { IonicStorageModule } from '@ionic/storage-angular';
import { SwipernavComponent } from './shared/swipernav/swipernav.component';
import { InProgressPageModule } from './quiz/in-progress/in-progress.module';
import { InProgressPage } from './quiz/in-progress/in-progress.page';

@NgModule({
declarations: [AppComponent, DetailContentPage],
entryComponents: [DetailContentPage],
declarations: [AppComponent, DetailContentPage,SwipernavComponent, InProgressPage],
entryComponents: [DetailContentPage, SwipernavComponent, InProgressPage],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
FormsModule,
CommonModule,
SwiperModule,
IonicStorageModule.forRoot()
IonicStorageModule.forRoot(),
],
exports: [
SwipernavComponent
],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent],
Expand Down
Loading

0 comments on commit 14c246a

Please sign in to comment.