Last active
March 10, 2024 18:17
-
-
Save cagb80/d73223afce977795641fb3ea4ef86ef8 to your computer and use it in GitHub Desktop.
Ionic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. IDEA | |
2. Make a design | |
3. Create a Blank project and GitHUB it | |
ionic start [Project Name] [blank] [--project-id] | |
4. Add ios to the project at least | |
ionic capacitor add ios | |
5. Create icons and SplashScreen | |
npm install @capacitor/assets --save-dev | |
npx capacitor-assets generate [--ios --android --pwa] | |
npm install @capacitor/splash-screen | |
npx cap sync | |
6. Oasis Global Vars/Functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { AlertController, LoadingController, NavController } from '@ionic/angular'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class OasisGlobals { | |
private apiServerURI = 'https://tt.apps.oasistech.info/'; | |
private appVersion = '0.0.1'; | |
public requestURL: string = this.apiServerURI + 'restApi/?appVersion=' + this.appVersion + '&action='; | |
loading: any = []; | |
constructor( | |
private navCtrl: NavController, | |
private alertCtrl: AlertController, | |
private loadingCtrl: LoadingController | |
) {} | |
public goTo(type: string, route: string) { | |
if (type == 'fwd') { | |
this.navCtrl.navigateForward(route); | |
} else if (type == 'root') { | |
this.navCtrl.navigateRoot(route, { animated: true }) | |
} | |
} | |
public async showBasicAlert(title: string, message: string) { | |
const alert = await this.alertCtrl.create({ | |
header: title, | |
message: message, | |
buttons: ['OK'], | |
}); | |
await alert.present(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ionic cap run [PLATFORM] --livereload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LoadingController } from '@ionic/angular'; | |
// public loadingCtrl: LoadingController | |
async presentLoading() { | |
const loading = await this.loadingCtrl.create({ | |
message: 'Hellooo', | |
duration: 2000 | |
}); | |
loading.present(); | |
this.SERVICES.FUNC((result) => { | |
setTimeout(() => { | |
loading.dismiss(); | |
}, 1500); | |
}); | |
} | |
// READ MORE https://ionicframework.com/docs/api/loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ADD IN APP MODULE | |
import { HttpClientModule } from '@angular/common/http'; | |
imports: [HttpClientModule] | |
// ADD IN SERVICE FILE | |
import { HttpClient } from '@angular/common/http'; | |
private http: HttpClient | |
// URL | |
import { projectEnv } from '../../custom-env'; | |
// POST | |
login(data: any) { | |
return new Promise((resolve, reject) => { | |
this.http.post(projectEnv.provider.url + 'login', JSON.stringify(data)) | |
.subscribe(res => { | |
resolve(res); | |
}, (err) => { | |
reject(err); | |
}); | |
}); | |
} | |
// GET | |
celebracionesInfo() { | |
return new Promise(resolve => { | |
this.http.get(projectEnv.provider.url + 'celebracionesInfo').subscribe(data => { | |
resolve(data); | |
}, err => { | |
console.log(err); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment