Skip to content

Commit

Permalink
beta build
Browse files Browse the repository at this point in the history
  • Loading branch information
OhMyGuus committed Jan 4, 2021
1 parent 21df0f7 commit 68660d5
Show file tree
Hide file tree
Showing 138 changed files with 171 additions and 50 deletions.
6 changes: 6 additions & 0 deletions android/.idea/compiler.xml

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

30 changes: 30 additions & 0 deletions android/.idea/jarRepositories.xml

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

4 changes: 4 additions & 0 deletions android/.idea/misc.xml

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

6 changes: 5 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
</application>

<!-- Permissions -->

<!-- my own permissions -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name = "android.permission.BLUETOOTH" />
<uses-permission android:name = "android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name = "android.permission.BLUETOOTH_ADMIN" />\

<uses-permission android:name="android.permission.INTERNET" />
<!-- Camera, Photos, input file -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
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/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.
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.
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_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
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-xxxhdpi/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-xxxhdpi/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.
46 changes: 44 additions & 2 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"e2e": "ng e2e",
"dev": "ionic serve --external --ssl"
},
"private": true,
"dependencies": {
Expand All @@ -27,6 +28,7 @@
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/user-agent": "^5.30.0",
"@ionic/angular": "^5.0.0",
"@ionic/storage": "^2.3.1",
"cordova-plugin-background-mode": "^0.7.3",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-useragent": "^1.0.6",
Expand Down
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/mipmap-ldpi/ic_launcher.png
Binary file added resources/blackberry10/icon/icon-110.png
Binary file added resources/blackberry10/icon/icon-144.png
Binary file added resources/blackberry10/icon/icon-90.png
Binary file added resources/blackberry10/icon/icon-96.png
Binary file modified resources/icon.png
Binary file added resources/ios/icon/AppIcon-20x20@1x.png
Binary file added resources/ios/icon/AppIcon-20x20@2x-1.png
Binary file added resources/ios/icon/AppIcon-20x20@2x.png
Binary file added resources/ios/icon/AppIcon-20x20@3x.png
Binary file added resources/ios/icon/AppIcon-29x29@1x.png
Binary file added resources/ios/icon/AppIcon-29x29@2x-1.png
Binary file added resources/ios/icon/AppIcon-29x29@2x.png
Binary file added resources/ios/icon/AppIcon-29x29@3x.png
Binary file added resources/ios/icon/AppIcon-40x40@1x.png
Binary file added resources/ios/icon/AppIcon-40x40@2x-1.png
Binary file added resources/ios/icon/AppIcon-40x40@2x.png
Binary file added resources/ios/icon/AppIcon-40x40@3x.png
Binary file added resources/ios/icon/AppIcon-512@2x.png
Binary file added resources/ios/icon/AppIcon-60x60@2x.png
Binary file added resources/ios/icon/AppIcon-60x60@3x.png
Binary file added resources/ios/icon/AppIcon-76x76@1x.png
Binary file added resources/ios/icon/AppIcon-76x76@2x.png
Binary file added resources/ios/icon/AppIcon-83.5x83.5@2x.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-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 modified resources/splash.png
5 changes: 3 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
import { IonicStorageModule } from '@ionic/storage';

@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [StatusBar, SplashScreen, BackgroundMode, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, IonicStorageModule.forRoot()],
providers: [StatusBar, SplashScreen, BackgroundMode, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy}],
bootstrap: [AppComponent],
})
export class AppModule {}
14 changes: 13 additions & 1 deletion src/app/comp/AudioController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EventEmitter as EventEmitterO } from 'events';
import Peer from 'simple-peer';
import * as io from 'socket.io-client';
import { AmongUsState, GameState, Player } from './AmongUsState';
import { SocketElementMap, SocketElement, Client, AudioElement, SocketClientMap } from './smallInterfaces';
import { SocketElementMap, SocketElement, Client, AudioElement, SocketClientMap, IDeviceInfo } from './smallInterfaces';

export default class AudioController extends EventEmitterO {
audioDeviceId = 'default';
Expand Down Expand Up @@ -133,6 +133,18 @@ export default class AudioController extends EventEmitterO {
element?.audioElement?.audioContext?.close();
element?.audioElement?.htmlAudioElement.remove();
}

async getDevices(): Promise<IDeviceInfo[]> {
let deviceId = 0;
return (await navigator.mediaDevices.enumerateDevices())
.filter((o) => o.kind === 'audioinput')
.map((o) => {
return {
label: o.label || `Microphone ${deviceId++}`,
deviceId: o.deviceId,
};
});
}
}

export const audioController = new AudioController();
4 changes: 2 additions & 2 deletions src/app/comp/ConnectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class ConnectionController extends EventEmitterO implements IConnectionControlle
return this.currentGameState.players.find((o) => o.clientId === clientId);
}

connect(gamecode: string, username: string, deviceID: string) {
connect(voiceserver: string, gamecode: string, username: string, deviceID: string) {
this.gamecode = gamecode;
this.amongusUsername = username;
this.deviceID = deviceID;
console.log('deviceID: ', deviceID);
this.initialize('https://crewl.ink');
this.initialize(voiceserver);
this.socketIOClient.emit('join', this.gamecode + '_mobile', Number(Date.now()), Number(Date.now()));
}

Expand Down
7 changes: 7 additions & 0 deletions src/app/comp/smallInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import Peer from 'simple-peer';
import { Player } from './AmongUsState';
import { connectionController } from './ConnectionController';

export interface ISettings {
voiceServer: string;
username: string;
gamecode: string;
selectedMicrophone: string;
}

export interface Client {
playerId: number;
clientId: number;
Expand Down
32 changes: 20 additions & 12 deletions src/app/main/main.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,41 @@
<div *ngIf="!cManager.joined; else connected">
<ion-list lines="full" class="ion-no-margin">
<ion-list-header lines="full">
<ion-label fixed class='fixedLabel'> Connection information </ion-label>
<ion-label fixed class="fixedLabel"> Connection information </ion-label>
</ion-list-header>
<ion-item>
<ion-label >Voice server</ion-label>
<ion-input [(ngModel)]="voiceserver" placeholder="Voice server"></ion-input>
<ion-label>Voice server</ion-label>
<ion-input
[(ngModel)]="settings.voiceServer"
(ionChange)="onSettingsChange()"
placeholder="Voice server"
></ion-input>
</ion-item>
<ion-item>
<ion-label>Ingame name</ion-label>
<ion-input [(ngModel)]="username" placeholder="ingamename"></ion-input>
<ion-input
[(ngModel)]="settings.username"
(ionChange)="onSettingsChange()"
placeholder="ingamename"
></ion-input>
</ion-item>
<ion-item>
<ion-label>Lobby code</ion-label>
<ion-input [(ngModel)]="gamecode" placeholder="lobbycode"></ion-input>
<ion-input [(ngModel)]="settings.gamecode" (ionChange)="onSettingsChange()" placeholder="lobbycode"></ion-input>
</ion-item>
<ion-item>
<ion-label>Microphone</ion-label>
<ion-select [(ngModel)]="selectedMicrophone" [compareWith]="compareFn">
<ion-select-option
*ngFor="let microphone of microphones; let i = index"
[value]="microphone"
>{{microphone.label}} -</ion-select-option
<ion-select
[(ngModel)]="settings.selectedMicrophone"
[compareWith]="compareFn"
(ionChange)="onSettingsChange()"
>
<ion-select-option *ngFor="let microphone of microphones;" [value]="microphone.deviceId"
>{{microphone.label}}</ion-select-option
>
</ion-select>
</ion-item>

<hr />

<ion-item>
<ion-button (click)="connect()">Connect</ion-button>
</ion-item>
Expand Down
63 changes: 34 additions & 29 deletions src/app/main/main.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,64 @@ import Peer from 'simple-peer';
import { connectionController, IConnectionController as IConnectionController } from '../comp/ConnectionController';
import { GameState, AmongUsState } from '../comp/AmongUsState';
import { promise } from 'protractor';
import { IDeviceInfo } from '../comp/smallInterfaces';

import { IDeviceInfo, ISettings } from '../comp/smallInterfaces';
import { Storage } from '@ionic/storage';
import { audioController } from '../comp/AudioController';

@Component({
selector: 'app-main',
templateUrl: './main.page.html',
styleUrls: ['./main.page.scss'],
})
export class MainPage implements OnInit {
constructor() {
connectionController.on('gamestateChange', (gamestate: AmongUsState) => {});
this.cManager = connectionController;
}
client: SocketIOClient.Socket;
peerConnections: Array<Peer> = [];
cManager: IConnectionController;
gameState: AmongUsState;
username = 'G';
gamecode = 'DEV12345';
testing: any = [];
microphones: IDeviceInfo[] = [];
selectedMicrophone: IDeviceInfo;
settings: ISettings = {
gamecode: '',
voiceServer: 'https://crewl.ink',
username: '',
selectedMicrophone: 'default',
};

async getDevices(): Promise<IDeviceInfo[]> {
let deviceId = 0;
return (await navigator.mediaDevices.enumerateDevices())
.filter((o) => o.kind === 'audioinput')
.map((o) => {
return {
label: o.label || `Microphone ${deviceId++}`,
deviceId: o.deviceId,
};
});
constructor(private storage: Storage) {
connectionController.on('gamestateChange', (gamestate: AmongUsState) => {});
this.cManager = connectionController;
storage.get('settings').then((val) => {
console.log('gotsettings', val);
if (val && val !== null) {
this.settings = val;
}
});
}

connect() {
console.log('[ConnectButton].[click]', {
gamecode: this.gamecode,
username: this.username,
selectedDevice: this.selectedMicrophone,
});
const audioSelect = document.querySelector('select#audioSource') as HTMLSelectElement;
connectionController.connect(this.gamecode, this.username, this.selectedMicrophone.deviceId);
connectionController.connect(
this.settings.voiceServer,
this.settings.gamecode,
this.settings.username,
this.settings.selectedMicrophone
);
}

disconnect() {
connectionController.disconnect();
}

onSettingsChange() {
console.log('onsettingschange');
this.storage.set('settings', this.settings);
}

compareFn(e1: string, e2: string): boolean {
return e1 && e2 ? e1 === e2 : false;
}

ngOnInit() {
this.getDevices().then((o) => {
audioController.getDevices().then((o) => {
this.microphones = o;
this.selectedMicrophone = this.microphones[0];
});
}
}
Binary file modified src/assets/icon/favicon.png

0 comments on commit 68660d5

Please sign in to comment.