├── .gitignore ├── LICENSE ├── README.md ├── api └── dtaalbers.Ionic.Api │ ├── dtaalbers.Ionic.Api.sln │ └── dtaalbers.Ionic.Api │ ├── Application │ ├── ApiSettings.cs │ ├── DependencyInjection.cs │ ├── Extensions │ │ └── AppBuilderExtensions.cs │ ├── Logger.cs │ ├── Models │ │ ├── Dto's.cs │ │ └── Media │ │ │ └── CreateMediaDto.cs │ └── RequestInterceptor.cs │ ├── Controllers │ ├── MediaController.cs │ └── PingController.cs │ ├── Program.cs │ ├── Startup.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ └── dtaalbers.Ionic.Api.csproj └── app ├── .editorconfig ├── .gitignore ├── config.xml ├── ionic.config.json ├── package.json ├── resources ├── android │ ├── icon │ │ ├── drawable-hdpi-icon.png │ │ ├── drawable-ldpi-icon.png │ │ ├── drawable-mdpi-icon.png │ │ ├── drawable-xhdpi-icon.png │ │ ├── drawable-xxhdpi-icon.png │ │ └── drawable-xxxhdpi-icon.png │ └── splash │ │ ├── drawable-land-hdpi-screen.png │ │ ├── drawable-land-ldpi-screen.png │ │ ├── drawable-land-mdpi-screen.png │ │ ├── drawable-land-xhdpi-screen.png │ │ ├── drawable-land-xxhdpi-screen.png │ │ ├── drawable-land-xxxhdpi-screen.png │ │ ├── drawable-port-hdpi-screen.png │ │ ├── drawable-port-ldpi-screen.png │ │ ├── drawable-port-mdpi-screen.png │ │ ├── drawable-port-xhdpi-screen.png │ │ ├── drawable-port-xxhdpi-screen.png │ │ └── drawable-port-xxxhdpi-screen.png ├── icon.png ├── ios │ ├── icon │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-50.png │ │ ├── icon-50@2x.png │ │ ├── icon-60.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72.png │ │ ├── icon-72@2x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ ├── icon-83.5@2x.png │ │ ├── icon-small.png │ │ ├── icon-small@2x.png │ │ ├── icon-small@3x.png │ │ ├── icon.png │ │ └── icon@2x.png │ └── splash │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape@2x~ipad.png │ │ ├── Default-Landscape@~ipadpro.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait@2x~ipad.png │ │ ├── Default-Portrait@~ipadpro.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default@2x~iphone.png │ │ └── Default~iphone.png └── splash.png ├── src ├── app │ ├── app.component.ts │ ├── app.html │ ├── app.module.ts │ ├── app.scss │ └── main.ts ├── application │ ├── AppConfiguration.ts │ ├── Helper.ts │ ├── mocks │ │ ├── CameraMock.ts │ │ ├── ImagePickerMock.ts │ │ └── ImageResizerMock.ts │ └── providers │ │ └── AppProvider.ts ├── assets │ ├── icon │ │ └── favicon.ico │ └── images │ │ └── logo.png ├── components │ └── progress-bar │ │ ├── progress-bar.html │ │ ├── progress-bar.scss │ │ └── progress-bar.ts ├── index.html ├── manifest.json ├── models │ └── UploadImage.ts ├── pages │ ├── about │ │ ├── about.html │ │ ├── about.scss │ │ └── about.ts │ ├── camera │ │ ├── camera.html │ │ ├── camera.scss │ │ └── camera.ts │ ├── home │ │ ├── home.html │ │ ├── home.scss │ │ └── home.ts │ ├── image-picker │ │ ├── image-picker.html │ │ ├── image-picker.scss │ │ └── image-picker.ts │ ├── tabs │ │ ├── tabs.html │ │ └── tabs.ts │ └── upload-example │ │ ├── upload-example.html │ │ ├── upload-example.scss │ │ └── upload-example.ts ├── service-worker.js ├── services │ ├── DialogService.ts │ ├── NotificationService.ts │ └── PluginService.ts └── theme │ └── variables.scss ├── tsconfig.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | #OS junk files 2 | [Tt]humbs.db 3 | *.DS_Store 4 | 5 | #Visual Studio files 6 | *.[Oo]bj 7 | *.user 8 | *.aps 9 | *.pch 10 | *.vspscc 11 | *.vssscc 12 | *_i.c 13 | *_p.c 14 | *.ncb 15 | *.suo 16 | *.tlb 17 | *.tlh 18 | *.bak 19 | *.[Cc]ache 20 | *.ilk 21 | *.log 22 | *.lib 23 | *.sbr 24 | *.sdf 25 | *.opensdf 26 | *.unsuccessfulbuild 27 | ipch/ 28 | [Oo]bj/ 29 | [Bb]in 30 | [Dd]ebug*/ 31 | [Rr]elease*/ 32 | Ankh.NoLoad 33 | 34 | #MonoDevelop 35 | *.pidb 36 | *.userprefs 37 | 38 | #Tooling 39 | _ReSharper*/ 40 | *.resharper 41 | [Tt]est[Rr]esult* 42 | *.sass-cache 43 | 44 | #Project files 45 | [Bb]uild/ 46 | 47 | #Subversion files 48 | .svn 49 | 50 | # Office Temp Files 51 | ~$* 52 | 53 | # vim Temp Files 54 | *~ 55 | 56 | #NuGet 57 | packages/ 58 | *.nupkg 59 | 60 | #ncrunch 61 | *ncrunch* 62 | *crunch*.local.xml 63 | 64 | # visual studio database projects 65 | *.dbmdl 66 | 67 | #Test files 68 | *.testsettings 69 | source/dtaalbers.TheHub.Web/Assets/Uploads/ 70 | source/dtaalbers.Web.TheHub/dtaalbers.TheHub.Web/Assets/Uploads/ 71 | source/dtaalbers.Web.TheHub/dtaalbers.TheHub.Web/App_Data/Elmah/ 72 | source/dtaalbers.Web.TheHub/dtaalbers.TheHub.Web/App_Data/Logs/ 73 | source/backend/dtaalbers.TheHub.Web/App_Data/Elmah/ 74 | source/backend/dtaalbers.TheHub.Web/App_Data/Logs/ 75 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Tom Aalbers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Ionic Example App 2 | 3 | #### # Intro 4 | 5 | Hi there! Here you can find the Ionic Example App. This app contains different examples on how to use the Ionic Framework. If you can't find your example, don't hesitate to create a issue and request an example! 6 | 7 | Next to the app I've also open sourced the code of the api (.NET Core `dotnet core`) that is running for the Ionic Example App. The endpoint for that api is `https://api.dtaalbers.com/ionic-example-app/`. Add `ping` to the url to ping the api so you can check if it is running. 8 | 9 | If you have questions and/or remarks, please make an issue and we can discuss it! 10 | 11 | #### # Things you need to know 12 | * Remember all the data processed by the app and api are stored on my server! 13 | * Licensed under MIT 14 | 15 | #### # Getting started 16 | 17 | 1. Fork the repo! 18 | 2. Clone the app to your HD. 19 | 3. Run the command `npm install` from the root to install the node modules 20 | 4. Run the command `ionic state reset` to install the platforms and plugins 21 | 5. Run the command `ionic serve` to open the app in the browser. 22 | -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.0.0 5 | MinimumVisualStudioVersion = 10.0.0.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dtaalbers.Ionic.Api", "dtaalbers.Ionic.Api/dtaalbers.Ionic.Api.csproj", "{2CDD8670-1840-426C-8D33-E5AC8317BA84}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2CDD8670-1840-426C-8D33-E5AC8317BA84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {2CDD8670-1840-426C-8D33-E5AC8317BA84}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {2CDD8670-1840-426C-8D33-E5AC8317BA84}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {2CDD8670-1840-426C-8D33-E5AC8317BA84}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/ApiSettings.cs: -------------------------------------------------------------------------------- 1 | namespace dtaalbers.Ionic.Api.Application 2 | { 3 | public class ApiSettings 4 | { 5 | /// 6 | /// The path to the uploads directory 7 | /// 8 | public string UploadsDirectory { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/DependencyInjection.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace dtaalbers.Ionic.Api.Application 5 | { 6 | public static class DependencyInjection 7 | { 8 | public static void Inject(IServiceCollection services, IConfigurationRoot configuration) 9 | { 10 | // Register the api settings 11 | services.Configure(configuration.GetSection("ApiSettings")); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/Extensions/AppBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNetCore.Builder; 3 | 4 | namespace dtaalbers.Ionic.Api.Application.Extensions 5 | { 6 | public static class AppBuilderExtensions 7 | { 8 | public static IApplicationBuilder UseRequestInterceptor(this IApplicationBuilder builder) 9 | { 10 | return builder.UseMiddleware(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/Logger.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Serilog; 3 | 4 | namespace dtaalbers.Ionic.Api.Application 5 | { 6 | /// 7 | /// Global logger that logs to 8 | /// 9 | public static class Logger 10 | { 11 | private static string Application { get; set; } 12 | 13 | /// 14 | /// Register a logger instance 15 | /// 16 | /// The name of the application using the logger 17 | /// The path to put the log files 18 | public static void Register(string application, string path) 19 | { 20 | if (!Directory.Exists(path)) throw new DirectoryNotFoundException(path); 21 | 22 | // Set application 23 | Application = application; 24 | 25 | var log = new LoggerConfiguration() 26 | .WriteTo.RollingFile(Path.Combine(path, "log_{Date}.txt")) 27 | .CreateLogger(); 28 | Log.Logger = log; 29 | } 30 | 31 | /// 32 | /// Log a informative message 33 | /// 34 | /// The message to log 35 | /// The function the message is being logged from 36 | public static void Information(string message, string function) 37 | => Log.Information($"[dtaalbers.Ionic.{Application}/{function}] {message} "); 38 | 39 | /// 40 | /// Log an error message 41 | /// 42 | /// The message to log 43 | /// The function the message is being logged from 44 | public static void Error(string message, string function) 45 | => Log.Error($"[dtaalbers.Ionic.{Application}/{function}] {message} "); 46 | 47 | /// 48 | /// Log a debug message 49 | /// 50 | /// The message to log 51 | /// The function the message is being logged from 52 | public static void Debug(string message, string function) 53 | => Log.Debug($"[dtaalbers.Ionic.{Application}/{function}] {message} "); 54 | } 55 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/Models/Dto's.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace dtaalbers.Ionic.Api.Application.Models 3 | { 4 | public class Dto_s 5 | { 6 | public Dto_s() 7 | { 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/Models/Media/CreateMediaDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNetCore.Http; 3 | 4 | namespace dtaalbers.Ionic.Api.Application.Models.Media 5 | { 6 | public class CreateMediaDto 7 | { 8 | /// 9 | /// The media file to save 10 | /// 11 | public IFormFile File { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Application/RequestInterceptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNetCore.Http; 4 | 5 | namespace dtaalbers.Ionic.Api.Application 6 | { 7 | public class RequestInterceptor 8 | { 9 | private readonly RequestDelegate _next; 10 | 11 | public RequestInterceptor(RequestDelegate next) => _next = next; 12 | 13 | public async Task Invoke(HttpContext context) 14 | { 15 | try 16 | { 17 | Logger.Information($"Path: {context.Request.Path}", "RequestInterceptor"); 18 | Logger.Information($"IP: {context.Connection.RemoteIpAddress}", "RequestInterceptor"); 19 | await _next.Invoke(context); 20 | } 21 | catch (Exception ex) 22 | { 23 | Logger.Error($"Error: {ex.Message} Stacktrace: {ex.StackTrace}", "RequestInterceptor"); 24 | context.Response.StatusCode = 500; 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Controllers/MediaController.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | using dtaalbers.Ionic.Api.Application; 4 | using dtaalbers.Ionic.Api.Application.Models.Media; 5 | using Microsoft.AspNetCore.Http; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Microsoft.Extensions.Options; 8 | 9 | namespace dtaalbers.Ionic.Api.Controllers 10 | { 11 | [Route("media")] 12 | public class MediaController : Controller 13 | { 14 | private readonly ApiSettings _apiSettings; 15 | 16 | /// 17 | /// The media controller constructor 18 | /// 19 | /// The api configuration settings 20 | public MediaController(IOptions options) 21 | { 22 | _apiSettings = options.Value; 23 | } 24 | 25 | /// 26 | /// Saves a new media file 27 | /// 28 | /// The media file to save 29 | /// 30 | [HttpPost] 31 | public async Task Post(CreateMediaDto media) 32 | { 33 | if (media?.File == null) return BadRequest("Unable to find media"); 34 | 35 | if (!Directory.Exists(_apiSettings.UploadsDirectory)) Directory.CreateDirectory(_apiSettings.UploadsDirectory); 36 | 37 | // Create full path and save the original media file 38 | var orignal = Path.Combine(_apiSettings.UploadsDirectory, media.File.FileName); 39 | using (var stream = new FileStream(orignal, FileMode.Create)) 40 | await media.File.CopyToAsync(stream); 41 | 42 | return Ok(); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Controllers/PingController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace dtaalbers.Ionic.Api.Controllers 4 | { 5 | [Route("ping")] 6 | public class PingController : Controller 7 | { 8 | /// 9 | /// Call this function to check if the api is available 10 | /// 11 | /// 12 | public ActionResult Get() => Ok("pong"); 13 | } 14 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Builder; 7 | using Microsoft.AspNetCore.Hosting; 8 | 9 | namespace dtaalbers.Ionic.Api 10 | { 11 | public class Program 12 | { 13 | public static void Main(string[] args) 14 | { 15 | var host = new WebHostBuilder() 16 | .UseKestrel() 17 | .UseContentRoot(Directory.GetCurrentDirectory()) 18 | .UseIISIntegration() 19 | .UseStartup() 20 | .Build(); 21 | 22 | host.Run(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/Startup.cs: -------------------------------------------------------------------------------- 1 | using dtaalbers.Ionic.Api.Application; 2 | using dtaalbers.Ionic.Api.Application.Extensions; 3 | using Microsoft.AspNetCore.Builder; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.AspNetCore.Routing; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.DependencyInjection; 8 | using Microsoft.Extensions.Logging; 9 | using Newtonsoft.Json.Serialization; 10 | 11 | namespace dtaalbers.Ionic.Api 12 | { 13 | public class Startup 14 | { 15 | public IConfigurationRoot Configuration { get; } 16 | 17 | public Startup(IHostingEnvironment env) 18 | { 19 | var builder = new ConfigurationBuilder() 20 | .SetBasePath(env.ContentRootPath) 21 | .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) 22 | .AddEnvironmentVariables(); 23 | Configuration = builder.Build(); 24 | } 25 | 26 | // This method gets called by the runtime. Use this method to add services to the container. 27 | public void ConfigureServices(IServiceCollection services) 28 | { 29 | services.Configure(options => options.LowercaseUrls = true); 30 | 31 | // Inject our dependencies 32 | DependencyInjection.Inject(services, Configuration); 33 | 34 | services.AddMvc() 35 | // We only accept snake cased json 36 | .AddJsonOptions(x => 37 | { 38 | x.SerializerSettings.ContractResolver = new DefaultContractResolver 39 | { 40 | NamingStrategy = new SnakeCaseNamingStrategy() 41 | }; 42 | }); 43 | } 44 | 45 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 46 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 47 | { 48 | // Configure CORS settings 49 | app.UseCors(builder => 50 | builder.WithOrigins("http://localhost:8100") 51 | .AllowAnyMethod() 52 | .AllowAnyHeader() 53 | .AllowCredentials() 54 | ); 55 | 56 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 57 | loggerFactory.AddDebug(); 58 | 59 | // Enable custom request interceptor 60 | // it will intercept every request made to the api 61 | app.UseRequestInterceptor(); 62 | 63 | app.UseMvc(); 64 | 65 | // Register logger 66 | Logger.Register("api", Configuration["ApiSettings:LogsPath"]); 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | }, 8 | "ApiSettings": { 9 | "UploadsDirectory": "", 10 | "LogsPath": "" 11 | } 12 | } -------------------------------------------------------------------------------- /api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api/dtaalbers.Ionic.Api.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | netcoreapp1.1 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 2.5.0-dev-00842 17 | 18 | 19 | 3.3.1-dev-00767 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | 10 | # We recommend you to keep these unchanged 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | *~ 5 | *.sw[mnpcod] 6 | *.log 7 | *.tmp 8 | *.tmp.* 9 | log.txt 10 | *.sublime-project 11 | *.sublime-workspace 12 | .vscode/ 13 | npm-debug.log* 14 | 15 | .idea/ 16 | .sass-cache/ 17 | .tmp/ 18 | .versions/ 19 | coverage/ 20 | dist/ 21 | node_modules/ 22 | tmp/ 23 | temp/ 24 | hooks/ 25 | platforms/ 26 | plugins/ 27 | plugins/android.json 28 | plugins/ios.json 29 | www/ 30 | $RECYCLE.BIN/ 31 | 32 | .DS_Store 33 | Thumbs.db 34 | UserInterfaceState.xcuserstate 35 | -------------------------------------------------------------------------------- /app/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ionic Examples 4 | A cool app that displays all kinds of examples on how to use the Ionic Framework 5 | dtaalbers 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /app/ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ionic-example-app", 3 | "app_id": "", 4 | "v2": true, 5 | "typescript": true 6 | } 7 | -------------------------------------------------------------------------------- /app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ionic-hello-world", 3 | "version": "0.0.0", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "private": true, 7 | "scripts": { 8 | "clean": "ionic-app-scripts clean", 9 | "build": "ionic-app-scripts build", 10 | "lint": "ionic-app-scripts lint", 11 | "ionic:build": "ionic-app-scripts build", 12 | "ionic:serve": "ionic-app-scripts serve" 13 | }, 14 | "dependencies": { 15 | "@angular/common": "4.1.2", 16 | "@angular/compiler": "4.1.2", 17 | "@angular/compiler-cli": "4.1.2", 18 | "@angular/core": "4.1.2", 19 | "@angular/forms": "4.1.2", 20 | "@angular/http": "4.1.2", 21 | "@angular/platform-browser": "4.1.2", 22 | "@angular/platform-browser-dynamic": "4.1.2", 23 | "@ionic-native/camera": "^3.11.0", 24 | "@ionic-native/core": "3.10.2", 25 | "@ionic-native/image-picker": "^3.11.0", 26 | "@ionic-native/image-resizer": "^3.12.1", 27 | "@ionic-native/in-app-browser": "^3.11.0", 28 | "@ionic-native/insomnia": "^3.12.1", 29 | "@ionic-native/splash-screen": "3.10.2", 30 | "@ionic-native/status-bar": "3.10.2", 31 | "@ionic-native/transfer": "^3.12.1", 32 | "@ionic/storage": "2.0.1", 33 | "ionic-angular": "3.3.0", 34 | "ionicons": "3.0.0", 35 | "rxjs": "5.1.1", 36 | "sw-toolbox": "3.6.0", 37 | "zone.js": "0.8.11" 38 | }, 39 | "devDependencies": { 40 | "@ionic/app-scripts": "1.3.7", 41 | "typescript": "2.3.3" 42 | }, 43 | "cordovaPlugins": [ 44 | "cordova-plugin-whitelist", 45 | "cordova-plugin-console", 46 | "cordova-plugin-device", 47 | "cordova-plugin-splashscreen", 48 | "cordova-plugin-statusbar", 49 | "ionic-plugin-keyboard" 50 | ], 51 | "cordovaPlatforms": [ 52 | "ios", 53 | { 54 | "platform": "ios", 55 | "version": "", 56 | "locator": "ios" 57 | } 58 | ], 59 | "description": "ionic-example-app: An Ionic project" 60 | } 61 | -------------------------------------------------------------------------------- /app/resources/android/icon/drawable-hdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /app/resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /app/resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /app/resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /app/resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /app/resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /app/resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /app/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/icon.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /app/resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /app/resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /app/resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/resources/splash.png -------------------------------------------------------------------------------- /app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Platform } from 'ionic-angular'; 3 | import { StatusBar } from '@ionic-native/status-bar'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | 6 | import { TabsPage } from '../pages/tabs/tabs'; 7 | 8 | @Component({ 9 | templateUrl: 'app.html' 10 | }) 11 | export class MyApp { 12 | rootPage:any = TabsPage; 13 | 14 | constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { 15 | platform.ready().then(() => { 16 | // Okay, so the platform is ready and our plugins are available. 17 | // Here you can do any higher level native things you might need. 18 | statusBar.styleDefault(); 19 | splashScreen.hide(); 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { IonicApp, IonicModule } from 'ionic-angular'; 4 | import { MyApp } from './app.component'; 5 | import { AppProvider } from '../application/providers/AppProvider'; 6 | import { AboutPage } from '../pages/about/about'; 7 | 8 | import { HomePage } from '../pages/home/home'; 9 | import { TabsPage } from '../pages/tabs/tabs'; 10 | import { CameraPage } from '../pages/camera/camera'; 11 | import { ImagePickerPage } from '../pages/image-picker/image-picker'; 12 | import { UploadExamplePage } from '../pages/upload-example/upload-example'; 13 | import { ProgressBarComponent } from '../components/progress-bar/progress-bar'; 14 | 15 | @NgModule({ 16 | declarations: [ 17 | MyApp, 18 | HomePage, 19 | TabsPage, 20 | CameraPage, 21 | ImagePickerPage, 22 | UploadExamplePage, 23 | AboutPage, 24 | ProgressBarComponent 25 | ], 26 | imports: [ 27 | BrowserModule, 28 | IonicModule.forRoot(MyApp) 29 | ], 30 | bootstrap: [IonicApp], 31 | entryComponents: [ 32 | MyApp, 33 | HomePage, 34 | TabsPage, 35 | CameraPage, 36 | ImagePickerPage, 37 | UploadExamplePage, 38 | AboutPage 39 | ], 40 | // We are using the custom written prodvider 41 | // here instead of the array that is normally 42 | // added here 43 | providers: AppProvider.get_providers() 44 | }) 45 | export class AppModule { } 46 | -------------------------------------------------------------------------------- /app/src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/v2/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | 18 | ion-content { 19 | color: #3c3838 !important; 20 | } 21 | 22 | .toast-info { 23 | .toast-wrapper { 24 | background: color($colors, info, base); 25 | } 26 | } 27 | 28 | .toast-warning { 29 | .toast-wrapper { 30 | background: color($colors, warning, base); 31 | } 32 | } 33 | 34 | .toast-danger { 35 | .toast-wrapper { 36 | background: color($colors, danger, base); 37 | } 38 | } 39 | 40 | .toast-success { 41 | .toast-wrapper { 42 | background: color($colors, success, base); 43 | } 44 | } -------------------------------------------------------------------------------- /app/src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /app/src/application/AppConfiguration.ts: -------------------------------------------------------------------------------- 1 | export class AppConfiguration { 2 | /** 3 | * The issue page of the app on github 4 | */ 5 | public static app_issues_github_page: string = 'https://github.com/dtaalbers/ionic-example-app/issues'; 6 | /** 7 | * The site of the developer (ME!) 8 | */ 9 | public static developer_site: string = 'https://dtaalbers.com'; 10 | /** 11 | * The base url endpoint of the api 12 | */ 13 | public static base_url: string = 'https://api.dtaalbers.com/ionic-example-app/'; 14 | /** 15 | * The app version 16 | */ 17 | public static app_version: string = '2.0.0' 18 | } -------------------------------------------------------------------------------- /app/src/application/Helper.ts: -------------------------------------------------------------------------------- 1 | export class Helper { 2 | /** 3 | * Creates a unique guid 4 | * @returns A guid 5 | */ 6 | public static guid = (): string => { 7 | return Helper.s4() + Helper.s4() + '-' + Helper.s4() + '-' + Helper.s4() + '-' + 8 | Helper.s4() + '-' + Helper.s4() + Helper.s4() + Helper.s4(); 9 | } 10 | 11 | /** 12 | * Generates a random string 13 | * @returns A random string 14 | */ 15 | private static s4(): string { 16 | return Math.floor((1 + Math.random()) * 0x10000) 17 | .toString(16) 18 | .substring(1); 19 | } 20 | } -------------------------------------------------------------------------------- /app/src/application/mocks/CameraMock.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This class mocks the cordova camera plugin on devices 3 | */ 4 | export class CameraMock { 5 | /** 6 | * Get a picture 7 | */ 8 | public getPicture(): Promise { 9 | return Promise.resolve('https://www.kenyabuzz.com/media/image-uploads/2016/04/27/landscape-1457107485-gettyimages-512366437.jpg'); 10 | } 11 | } -------------------------------------------------------------------------------- /app/src/application/mocks/ImagePickerMock.ts: -------------------------------------------------------------------------------- 1 | export class ImagePickerMock { 2 | /** 3 | * Get pictures from albums 4 | */ 5 | public getPictures(): Promise> { 6 | return Promise.resolve([ 7 | 'https://www.kenyabuzz.com/media/image-uploads/2016/04/27/landscape-1457107485-gettyimages-512366437.jpg', 8 | 'http://cdn2-www.dogtime.com/assets/uploads/gallery/30-impossibly-cute-puppies/impossibly-cute-puppy-8.jpg', 9 | 'http://inanutshell.ca/wp-content/uploads/2014/11/Gorgeous_puppies.jpg' 10 | ]); 11 | } 12 | } -------------------------------------------------------------------------------- /app/src/application/mocks/ImageResizerMock.ts: -------------------------------------------------------------------------------- 1 | import { ImageResizerOptions } from "@ionic-native/image-resizer"; 2 | 3 | export class ImageResizerMock { 4 | 5 | /** 6 | * Resizes an image 7 | * @param options The resize options 8 | */ 9 | public resize(options: ImageResizerOptions): Promise { 10 | return Promise.resolve(options.uri); 11 | } 12 | } -------------------------------------------------------------------------------- /app/src/application/providers/AppProvider.ts: -------------------------------------------------------------------------------- 1 | import { ErrorHandler } from '@angular/core'; 2 | import { IonicErrorHandler } from 'ionic-angular'; 3 | 4 | import { PluginService } from '../../services/PluginService'; 5 | import { NotificationService } from '../../services/NotificationService'; 6 | 7 | import { StatusBar } from '@ionic-native/status-bar'; 8 | import { SplashScreen } from '@ionic-native/splash-screen'; 9 | import { InAppBrowser } from '@ionic-native/in-app-browser'; 10 | import { Camera } from '@ionic-native/camera'; 11 | import { ImagePicker } from '@ionic-native/image-picker'; 12 | import { Insomnia } from '@ionic-native/insomnia'; 13 | import { Transfer } from '@ionic-native/transfer'; 14 | import { ImageResizer } from '@ionic-native/image-resizer'; 15 | 16 | import { CameraMock } from '../mocks/CameraMock'; 17 | import { ImagePickerMock } from '../mocks/ImagePickerMock'; 18 | import { ImageResizerMock } from '../mocks/ImageResizerMock'; 19 | import { DialogService } from '../../services/DialogService'; 20 | 21 | export class AppProvider { 22 | 23 | /** 24 | * Decide whether to use the mocks or the real plugins 25 | */ 26 | public static get_providers() { 27 | let providers; 28 | // Here we check if we are using the app in the browser (for development) or 29 | // if we are using the app on a devices 30 | // Example is from https://www.joshmorony.com/automating-mocks-in-ionic-native-3-x/ 31 | if (document.URL.includes('https://') || document.URL.includes('http://')) { 32 | // The http or https protocol is used. So we can savely say that we're working 33 | // in the browser. Use the mocks that will mock the cordova plugins 34 | providers = [ 35 | StatusBar, 36 | SplashScreen, 37 | InAppBrowser, 38 | Insomnia, 39 | Transfer, 40 | { provide: ImageResizer, useClass: ImageResizerMock }, 41 | { provide: Camera, useClass: CameraMock }, 42 | { provide: ImagePicker, useClass: ImagePickerMock }, 43 | PluginService, 44 | NotificationService, 45 | DialogService, 46 | { provide: ErrorHandler, useClass: IonicErrorHandler }, 47 | ]; 48 | } else { 49 | // We are now working the app on a device. We can use the cordova 50 | // pluings. Yeah! 51 | providers = [ 52 | StatusBar, 53 | SplashScreen, 54 | InAppBrowser, 55 | Insomnia, 56 | Transfer, 57 | ImageResizer, 58 | Camera, 59 | ImagePicker, 60 | PluginService, 61 | NotificationService, 62 | DialogService, 63 | { provide: ErrorHandler, useClass: IonicErrorHandler } 64 | ]; 65 | } 66 | return providers; 67 | } 68 | } -------------------------------------------------------------------------------- /app/src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /app/src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaalbers/ionic-example-app/1d11b4269bfddce17c3be8bb5f29981994d292a3/app/src/assets/images/logo.png -------------------------------------------------------------------------------- /app/src/components/progress-bar/progress-bar.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{ progress }}% 4 |
5 |
-------------------------------------------------------------------------------- /app/src/components/progress-bar/progress-bar.scss: -------------------------------------------------------------------------------- 1 | progress-bar { 2 | .progress-outer { 3 | width: 96%; 4 | margin: 10px 2%; 5 | padding: 3px; 6 | text-align: center; 7 | background-color: #f4f4f4; 8 | border: 1px solid #dcdcdc; 9 | color: #fff; 10 | border-radius: 20px; 11 | } 12 | 13 | .progress-inner { 14 | min-width: 15%; 15 | white-space: nowrap; 16 | overflow: hidden; 17 | padding: 5px; 18 | border-radius: 20px; 19 | background-color: map-get($colors, primary); 20 | } 21 | } -------------------------------------------------------------------------------- /app/src/components/progress-bar/progress-bar.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'progress-bar', 5 | templateUrl: 'progress-bar.html' 6 | }) 7 | /** 8 | * Credits to https://www.joshmorony.com/build-a-simple-progress-bar-component-in-ionic-2/ 9 | * for the example 10 | */ 11 | export class ProgressBarComponent { 12 | /** 13 | * The amount of progress made 14 | */ 15 | @Input('progress') public progress: number; 16 | } -------------------------------------------------------------------------------- /app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /app/src/models/UploadImage.ts: -------------------------------------------------------------------------------- 1 | export class UploadImage { 2 | /** 3 | * A identifier 4 | */ 5 | public guid: string; 6 | /** 7 | * The path to the upload image 8 | */ 9 | public path: string; 10 | /** 11 | * The thumbnail of the image 12 | */ 13 | public thumb: string; 14 | /** 15 | * A flag that indicates whether this image is uploaded or not 16 | */ 17 | public uploaded?: boolean = false; 18 | 19 | public constructor(init?: UploadImage) { 20 | Object.assign(this, init); 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/pages/about/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | About 4 | 5 | 6 | 7 | 8 |
Hi there!
9 |

10 | My name is Tom Aalbers. I am a reasonable experienced developer (full stack) in the Ionic, Aurelia and .NET frameworks. I 11 | work with these frameworks every day. 12 |

13 |
14 |

15 | A long time ago I started the Ionic 2 Examples repo which into, I added a few examples on how to work 16 | with the Ionic Framework. I received a lot of positive feedback and requests after that. So that is why I started 17 | this ionic example app to show some examples on how to use the framework. If you want to get in touch you can head 18 | over to my website and contact me through any of the options there. If you can't 19 | find your example, head over to the github page and create an issue to request 20 | it! I will try to add them when I can! 21 |

22 |
-------------------------------------------------------------------------------- /app/src/pages/about/about.scss: -------------------------------------------------------------------------------- 1 | page-about { 2 | #about-content { 3 | .scroll-content { 4 | padding: 15px; 5 | text-align: center; 6 | } 7 | 8 | h6 { 9 | margin: 10px 0 2px 0; 10 | font-weight: bold; 11 | text-align: left; 12 | } 13 | 14 | p { 15 | margin: 0px 0; 16 | text-align: left; 17 | } 18 | 19 | img { 20 | height: 140px; 21 | margin: -20px 0; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/pages/about/about.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { InAppBrowser } from '@ionic-native/in-app-browser'; 3 | import { AppConfiguration } from '../../application/AppConfiguration'; 4 | 5 | @Component({ 6 | selector: 'page-about', 7 | templateUrl: 'about.html' 8 | }) 9 | export class AboutPage { 10 | 11 | constructor( 12 | private in_app_browser: InAppBrowser 13 | ) { } 14 | 15 | /** 16 | * Opens the issues page of the app in github 17 | */ 18 | public open_github_page(): void { 19 | let iab = this.in_app_browser.create(AppConfiguration.app_issues_github_page, '_blank'); 20 | iab.show(); 21 | } 22 | 23 | /** 24 | * Opens the developer site 25 | */ 26 | public open_developer_site(): void { 27 | let iab = this.in_app_browser.create(AppConfiguration.developer_site, '_blank'); 28 | iab.show(); 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /app/src/pages/camera/camera.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Camera Example 4 | 5 | 6 | 7 |

8 | This page displays an example on how to use the camera plugin. It will display a fixed image when developing in the browser 9 | and the taken image when using a device. Check src/logic/mocks/CameraMock.ts if you want to 10 | change the image. 11 |

12 | 13 |
14 |
-------------------------------------------------------------------------------- /app/src/pages/camera/camera.scss: -------------------------------------------------------------------------------- 1 | page-camera { 2 | #camera-content { 3 | .scroll-content { 4 | padding: 15px; 5 | } 6 | 7 | .image { 8 | width: 90vw; 9 | height: 200px; 10 | background-size: cover; 11 | background-repeat: no-repeat; 12 | background-position: center center; 13 | margin-top: 20px; 14 | } 15 | 16 | button { 17 | width: 100%; 18 | margin-top: 10px; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/pages/camera/camera.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { PluginService } from '../../services/PluginService'; 3 | 4 | @Component({ 5 | selector: 'page-camera', 6 | templateUrl: 'camera.html', 7 | }) 8 | export class CameraPage { 9 | 10 | /** 11 | * The url of the taken image 12 | */ 13 | public image: string; 14 | 15 | constructor( 16 | private plugin_service: PluginService 17 | ) { } 18 | 19 | /** 20 | * Opens the camera and display the taken picture if available 21 | */ 22 | public async open_camera(): Promise { 23 | this.image = await this.plugin_service.open_camera(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Home 4 | 5 | 6 | 7 | 8 |

v{{ app_version }}

9 |
Hi there!
10 |

11 | Welcome to the Ionic Example App. Here you can see different examples on how to use the Ionic Framework. 12 |

13 |
About the app
14 |

15 | These examples are made in my spare time and the way I think they could be implemented. My way is not perfect and I am always 16 | willing to learn. So if you have any remarks or improvements, don't hesitate to create an issue on the 17 | github page. 18 |

19 |
Api and data storage
20 |

21 | With some cordova plugins it is required to connect the app to an external resource, for example the upload part of the transfer 22 | plugin. For that I will create an API (written in the C# dotnet core framework). This API will run on the following endpoint 23 | https://api.dtaalbers.com/ionic-example-app. 24 | This api will recieve and store and data you send to it. So be aware of that. Docs will be available when it goes live. 25 |

26 |
-------------------------------------------------------------------------------- /app/src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | #home-content { 3 | .scroll-content { 4 | padding: 15px; 5 | text-align: center; 6 | } 7 | 8 | .version { 9 | text-align: center; 10 | } 11 | 12 | h6 { 13 | margin: 10px 0 2px 0; 14 | font-weight: bold; 15 | text-align: left; 16 | } 17 | 18 | p { 19 | margin: 0px 0; 20 | text-align: left; 21 | } 22 | 23 | img { 24 | height: 140px; 25 | margin: -20px 0; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { InAppBrowser } from '@ionic-native/in-app-browser'; 3 | import { AppConfiguration } from '../../application/AppConfiguration'; 4 | 5 | @Component({ 6 | selector: 'page-home', 7 | templateUrl: 'home.html' 8 | }) 9 | export class HomePage { 10 | 11 | /** 12 | * The version of the app 13 | */ 14 | public app_version: string = AppConfiguration.app_version; 15 | 16 | constructor( 17 | private in_app_browser: InAppBrowser 18 | ) { } 19 | 20 | /** 21 | * Opens the issues page of the app in github 22 | */ 23 | public open_github_page(): void { 24 | // Note that I added '_blank' as extra parameter. This is because when you don't add 25 | // the page won't be opened in the in app browser on ios devices. It will use the 26 | // default browser on the device instead. Apple does not like that as it makes 27 | // you leave the app 28 | let iab = this.in_app_browser.create(AppConfiguration.app_issues_github_page, '_blank'); 29 | iab.show(); 30 | } 31 | 32 | /** 33 | * Opens the developer site 34 | */ 35 | public open_developer_site(): void { 36 | let iab = this.in_app_browser.create(AppConfiguration.developer_site, '_blank'); 37 | iab.show(); 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /app/src/pages/image-picker/image-picker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Image Picker Example 4 | 5 | 6 | 7 |

8 | This page displays an example on how to use the image picker plugin. It will display a fixed collection 9 | of images when developing in the browser and the selected images when using a device. Check src/logic/mocks/ImagePicker.ts 10 | if you want to change the images. 11 |

12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 |
20 |
-------------------------------------------------------------------------------- /app/src/pages/image-picker/image-picker.scss: -------------------------------------------------------------------------------- 1 | page-image-picker { 2 | 3 | #image-picker-header { 4 | .toolbar { 5 | .toolbar-title { 6 | overflow: visible; 7 | } 8 | } 9 | } 10 | 11 | #image-picker-content { 12 | .scroll-content { 13 | padding: 15px; 14 | } 15 | 16 | .image { 17 | height: 100px; 18 | background-size: cover; 19 | background-repeat: no-repeat; 20 | background-position: center center; 21 | } 22 | 23 | button { 24 | width: 100%; 25 | margin-top: 10px; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/pages/image-picker/image-picker.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { PluginService } from '../../services/PluginService'; 3 | 4 | @Component({ 5 | selector: 'page-image-picker', 6 | templateUrl: 'image-picker.html', 7 | }) 8 | export class ImagePickerPage { 9 | 10 | /** 11 | * The urls of the selected images 12 | */ 13 | public images: Array = []; 14 | 15 | constructor( 16 | private plugin_service: PluginService 17 | ) { } 18 | 19 | /** 20 | * Opens the albums and displays the selected images if available 21 | */ 22 | public async open_albums(): Promise { 23 | this.images = this.images.concat(await this.plugin_service.open_albums()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/pages/tabs/tabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/pages/tabs/tabs.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { HomePage } from '../home/home'; 3 | import { CameraPage } from '../camera/camera'; 4 | import { ImagePickerPage } from '../image-picker/image-picker'; 5 | import { UploadExamplePage } from '../upload-example/upload-example'; 6 | import { AboutPage } from '../about/about'; 7 | 8 | @Component({ 9 | templateUrl: 'tabs.html' 10 | }) 11 | export class TabsPage { 12 | /** 13 | * The first tab will be the homepage 14 | */ 15 | tab1Root = HomePage; 16 | /** 17 | * The second page is the camera example page 18 | */ 19 | tab2Root = CameraPage; 20 | /** 21 | * The third page is the image picker example page 22 | */ 23 | tab3Root = ImagePickerPage; 24 | /** 25 | * The fourth page is the upload example page 26 | */ 27 | tab4Root = UploadExamplePage; 28 | /** 29 | * The fifth page is the about page 30 | */ 31 | tab5Root = AboutPage; 32 | } 33 | -------------------------------------------------------------------------------- /app/src/pages/upload-example/upload-example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Upload Example 4 | 5 | 8 | 9 | 10 | 11 | 12 |

13 | This page displays an example on how to use the transfer plugin. Note: This example will not work in the browser. You have 14 | to deploy the app on a device to see it how it works. 15 |

16 |
17 | Image {{ current + 1 }} of {{ total }} 18 | 19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 |
44 |
45 |
46 |
47 |
-------------------------------------------------------------------------------- /app/src/pages/upload-example/upload-example.scss: -------------------------------------------------------------------------------- 1 | upload-example { 2 | #upload-example-content { 3 | .scroll-content { 4 | padding: 15px; 5 | } 6 | 7 | .upload-info { 8 | span { 9 | margin-left: 10px; 10 | } 11 | } 12 | 13 | .image { 14 | height: 100px; 15 | background-size: cover; 16 | background-repeat: no-repeat; 17 | background-position: center center; 18 | } 19 | 20 | .uploaded { 21 | opacity: .2; 22 | } 23 | 24 | .check { 25 | position: absolute; 26 | font-size: 30pt; 27 | font-weight: bold; 28 | left: calc(50% - 15px); 29 | top: calc(50% - 10px); 30 | } 31 | 32 | .image-col { 33 | button { 34 | width: 100% !important; 35 | height: 20px !important; 36 | margin: 0; 37 | 38 | ion-icon { 39 | margin: 0; 40 | } 41 | } 42 | } 43 | 44 | button { 45 | width: 100% !important; 46 | font-size: 12pt; 47 | border-radius: 0; 48 | 49 | ion-icon { 50 | margin-right: 10px; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/pages/upload-example/upload-example.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { PluginService } from '../../services/PluginService'; 3 | import { Insomnia } from '@ionic-native/insomnia'; 4 | import { NotificationService } from '../../services/NotificationService'; 5 | import { Transfer, TransferObject, FileUploadResult } from '@ionic-native/transfer'; 6 | import { AppConfiguration } from '../../application/AppConfiguration'; 7 | import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer'; 8 | import { UploadImage } from '../../models/UploadImage'; 9 | import { Helper } from "../../application/Helper"; 10 | import { DialogService } from '../../services/DialogService'; 11 | import { LoadingController } from 'ionic-angular'; 12 | 13 | @Component({ 14 | selector: 'upload-example', 15 | templateUrl: 'upload-example.html' 16 | }) 17 | export class UploadExamplePage { 18 | /** 19 | * The selected images 20 | */ 21 | public images: Array = []; 22 | /** 23 | * A flag that indicates whether the app is uploading files or not 24 | */ 25 | public is_uploading: boolean = false; 26 | /** 27 | * The index of the current image being uploaded 28 | */ 29 | public current: number = 0; 30 | /** 31 | * Total images to upload 32 | */ 33 | public total: number; 34 | /** 35 | * Amount of progress made during an image upload 36 | */ 37 | public progress: number = 0; 38 | /** 39 | * The transfer object 40 | */ 41 | private file_transfer: TransferObject = this.transfer.create(); 42 | /** 43 | * A collection of upload responses 44 | */ 45 | public upload_responses: any = []; 46 | 47 | constructor( 48 | private plugin_service: PluginService, 49 | private ng_zone: NgZone, 50 | private insomnia: Insomnia, 51 | private notification_service: NotificationService, 52 | private transfer: Transfer, 53 | private image_resizer: ImageResizer, 54 | private dialog_service: DialogService 55 | ) { } 56 | 57 | /** 58 | * Opens the albums and displays the selected images if available 59 | */ 60 | public async open_albums(): Promise { 61 | let originals = await this.plugin_service.open_albums(); 62 | // Map the originals to an array of UploadImage 63 | let requests = await originals.map(async x => new UploadImage({ 64 | path: x, 65 | guid: Helper.guid(), 66 | thumb: await this.resize(x) 67 | })); 68 | let images = await Promise.all(requests); 69 | // Save the originals 70 | this.images = this.images.concat(images); 71 | } 72 | 73 | /** 74 | * Opens the camera and displays the picture if available 75 | */ 76 | public async open_camera(): Promise { 77 | let orignal = await this.plugin_service.open_camera(); 78 | this.images.push(new UploadImage({ 79 | path: orignal, 80 | guid: Helper.guid(), 81 | thumb: await this.resize(orignal) 82 | })); 83 | } 84 | 85 | /** 86 | * Resizes an image 87 | * @param original The path to the original image 88 | */ 89 | private async resize(original: string): Promise { 90 | let options = { 91 | uri: original, 92 | folderName: 'Protonet', 93 | quality: 90, 94 | width: 1280, 95 | height: 1280 96 | } as ImageResizerOptions; 97 | return this.image_resizer.resize(options); 98 | } 99 | 100 | /** 101 | * Deletes a image 102 | * @param image The images to dlete 103 | */ 104 | private delete(image: UploadImage): void { 105 | this.dialog_service.confirm_delete('Are you sure you want to delete this image?', confirmed => { 106 | if (confirmed) this.images = this.images.filter(x => x.guid != image.guid); 107 | }); 108 | } 109 | 110 | /** 111 | * Starts the upload of the 112 | */ 113 | public async start_upload(): Promise { 114 | // Set upload metadata 115 | this.is_uploading = true; 116 | this.total = this.images.length; 117 | // Keep the phone awake (e.g. dont let go in sleep mode) 118 | this.insomnia.keepAwake() 119 | // Start the first upload 120 | this.upload(); 121 | } 122 | 123 | /** 124 | * The on upload progress callback event 125 | * @param progressEvent The progress event of the image upload 126 | */ 127 | public on_progress = (progressEvent: ProgressEvent): void => { 128 | this.ng_zone.run(() => { 129 | if (progressEvent.lengthComputable) { 130 | let progress = Math.round((progressEvent.loaded / progressEvent.total) * 100); 131 | if (progress > 100) progress = 100; 132 | if (progress < 0) progress = 0; 133 | this.progress = progress; 134 | } 135 | }); 136 | } 137 | 138 | /** 139 | * Actually uploads an image 140 | */ 141 | public async upload(): Promise { 142 | // Bind the progress function 143 | this.file_transfer.onProgress(this.on_progress); 144 | // Prepare our upload options 145 | let options = { 146 | fileKey: 'file', 147 | fileName: this.images[this.current].path.split('/').pop(), 148 | mimeType: 'image/jpeg', 149 | chunkedMode: false, 150 | headers: { 151 | 'Content-Type': undefined 152 | }, 153 | params: {} 154 | }; 155 | try { 156 | // Start uploading! 157 | let result = await this.file_transfer.upload( 158 | encodeURI(this.images[this.current].path), 159 | encodeURI(AppConfiguration.base_url + 'media/'), 160 | options, 161 | false 162 | ); 163 | this.on_success(result); 164 | } catch (e) { 165 | this.on_failed(e); 166 | } 167 | } 168 | 169 | /** 170 | * The on success upload callback 171 | * @param result The upload result 172 | */ 173 | public on_success = (result: FileUploadResult): void => { 174 | // Mark the image as uploaded 175 | this.images[this.current].uploaded = true; 176 | // Do we have more to upload? 177 | if (this.current + 1 < this.images.length) { 178 | // Yes, we have. Up the current index 179 | this.current++; 180 | // reset the progress 181 | this.progress = 0; 182 | // and start the upload 183 | this.upload(); 184 | } else { 185 | // No, we're done with uploading. Allow the device to sleep again. 186 | // This is important, because if you don't allow sleep again 187 | // in any case, apple wont accept your app in the store. 188 | this.insomnia.allowSleepAgain(); 189 | this.is_uploading = false; 190 | this.images = []; 191 | this.current = 0; 192 | this.notification_service.notify_success('Succesfully uploaded your images'); 193 | } 194 | } 195 | 196 | /** 197 | * The on failed upload callback 198 | * @param error The upload error 199 | */ 200 | public on_failed = (error: any): void => { 201 | this.is_uploading = false; 202 | // Something went wrong, allow sleep again 203 | this.insomnia.allowSleepAgain(); 204 | // These are cancel events, if user canceled don't do anything 205 | if (error.code == 3 || error.code == 4) return; 206 | // Notify the user that something went wrong. 207 | this.notification_service.notify_error(error); 208 | } 209 | } 210 | 211 | -------------------------------------------------------------------------------- /app/src/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechrome.github.io/sw-toolbox/ for 3 | * more info on how to use sw-toolbox to custom configure your service worker. 4 | */ 5 | 6 | 7 | 'use strict'; 8 | importScripts('./build/sw-toolbox.js'); 9 | 10 | self.toolbox.options.cache = { 11 | name: 'ionic-cache' 12 | }; 13 | 14 | // pre-cache our key assets 15 | self.toolbox.precache( 16 | [ 17 | './build/main.js', 18 | './build/main.css', 19 | './build/polyfills.js', 20 | 'index.html', 21 | 'manifest.json' 22 | ] 23 | ); 24 | 25 | // dynamically cache any other local assets 26 | self.toolbox.router.any('/*', self.toolbox.cacheFirst); 27 | 28 | // for any other requests go to the network, cache, 29 | // and then only use that cached resource if your user goes offline 30 | self.toolbox.router.default = self.toolbox.networkFirst; 31 | -------------------------------------------------------------------------------- /app/src/services/DialogService.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { AlertController, AlertOptions } from 'ionic-angular'; 3 | 4 | @Injectable() 5 | export class DialogService { 6 | 7 | constructor( 8 | private alert_controller: AlertController 9 | ) { } 10 | 11 | /** 12 | * Opens a modal to ask if the user is sure to delete 13 | * @param message The delete question 14 | * @param on_confirmed The on confirmed callback 15 | * @param on_cancel The on cancel callback 16 | */ 17 | public confirm_delete(question: string, on_confirmed: Function, on_cancel?: Function): void { 18 | let alert = this.alert_controller.create({ 19 | title: 'Warning', 20 | message: question, 21 | buttons: [ 22 | { 23 | text: 'Delete', 24 | handler: typeof (on_confirmed) === 'function' ? on_confirmed : () => { } 25 | }, 26 | { 27 | text: 'Cancel', 28 | role: 'cancel', 29 | handler: typeof (on_cancel) === 'function' ? on_cancel : () => { } 30 | } 31 | ] 32 | } as AlertOptions); 33 | alert.present(); 34 | } 35 | 36 | /** 37 | * Opens a modal to ask if the user is sure of something 38 | * @param question The delete question 39 | * @param on_confirmed The on confirmed callback 40 | * @param on_cancel The on cancel callback 41 | */ 42 | public confirm(question: string, on_confirmed: Function, on_cancel?: Function): void { 43 | let alert = this.alert_controller.create({ 44 | title: 'Warning', 45 | message: question, 46 | buttons: [ 47 | { 48 | text: 'Continue', 49 | handler: typeof (on_confirmed) === 'function' ? on_confirmed : () => { } 50 | }, 51 | { 52 | text: 'Cancel', 53 | role: 'cancel', 54 | handler: typeof (on_cancel) === 'function' ? on_cancel : () => { } 55 | } 56 | ] 57 | } as AlertOptions); 58 | alert.present(); 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/services/NotificationService.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ToastController } from 'ionic-angular'; 3 | 4 | @Injectable() 5 | export class NotificationService { 6 | 7 | /** 8 | * The amount of time to show a toast (in milliseconds) 9 | */ 10 | private time_show_time: number = 3000; 11 | /** 12 | * The position of the toast 13 | */ 14 | private toast_position: string = 'bottom'; 15 | /** 16 | * The close toast button text 17 | */ 18 | private toast_close_text: string = 'Close'; 19 | /** 20 | * A flag that decides whether to show the toast close button 21 | */ 22 | private show_toast_close_button: boolean = true; 23 | 24 | constructor( 25 | private toast_controller: ToastController 26 | ) { } 27 | 28 | /** 29 | * Notifies the user that an error has occurred 30 | * @param message The error that occurred 31 | */ 32 | public notify_error(error: any, details?: string): void { 33 | console.log(error, details); 34 | let toast = this.toast_controller.create({ 35 | message: 'Something went wrong. Try again later', 36 | duration: this.time_show_time, 37 | position: this.toast_position, 38 | showCloseButton: this.show_toast_close_button, 39 | closeButtonText: this.toast_close_text, 40 | cssClass: 'toast-danger' 41 | }); 42 | toast.present(); 43 | } 44 | 45 | /** 46 | * Notifies the user with a custom message in info styles 47 | * @param message The message for the user 48 | */ 49 | public notify_info(message: string): void { 50 | let toast = this.toast_controller.create({ 51 | message: message, 52 | duration: this.time_show_time, 53 | position: this.toast_position, 54 | showCloseButton: this.show_toast_close_button, 55 | closeButtonText: this.toast_close_text, 56 | cssClass: 'toast-info' 57 | }); 58 | toast.present(); 59 | } 60 | 61 | /** 62 | * Notifies the user with a custom message in warning styles 63 | * @param message The message for the user 64 | */ 65 | public notify_warning(message: string): void { 66 | let toast = this.toast_controller.create({ 67 | message: message, 68 | duration: this.time_show_time, 69 | position: this.toast_position, 70 | showCloseButton: this.show_toast_close_button, 71 | closeButtonText: this.toast_close_text, 72 | cssClass: 'toast-warning' 73 | }); 74 | toast.present(); 75 | } 76 | 77 | /** 78 | * Notifies the user with a custom message in success styles 79 | * @param message The message for the user 80 | */ 81 | public notify_success(message: string): void { 82 | let toast = this.toast_controller.create({ 83 | message: message, 84 | duration: this.time_show_time, 85 | position: this.toast_position, 86 | showCloseButton: this.show_toast_close_button, 87 | closeButtonText: this.toast_close_text, 88 | cssClass: 'toast-success' 89 | }); 90 | toast.present(); 91 | } 92 | } -------------------------------------------------------------------------------- /app/src/services/PluginService.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Camera } from '@ionic-native/camera'; 3 | import { ImagePicker } from '@ionic-native/image-picker'; 4 | 5 | /** 6 | * This is the plugin service. Following the DRY approach I've created 7 | * a service that you can call when you want use plugins. A service because 8 | * you probabaly want to re-use the camera on multiple locations. 9 | */ 10 | @Injectable() 11 | export class PluginService { 12 | 13 | constructor( 14 | private camera: Camera, 15 | private image_picker: ImagePicker 16 | ) { } 17 | 18 | /** 19 | * Opens the camera so that the user can take a picture 20 | * @return The url of the taken image 21 | */ 22 | public open_camera(): Promise { 23 | return this.camera.getPicture({ 24 | // We want to have the URL to the file 25 | destinationType: this.camera.DestinationType ? this.camera.DestinationType.FILE_URI : 1, 26 | // Source of the images is the camera 27 | sourceType: this.camera.PictureSourceType ? this.camera.PictureSourceType.CAMERA : 1, 28 | // Encoding type is JPEG 29 | encodingType: this.camera.EncodingType ? this.camera.EncodingType.JPEG : 0, 30 | // Give us the full quality of the image, lower it for better performance 31 | quality: 100, 32 | // Allow editing of the image after its taken 33 | allowEdit: false, 34 | // When a image is taken via the camera also save it to the native photo album 35 | saveToPhotoAlbum: true, 36 | // Correct the orrientation of the image 37 | correctOrientation: true 38 | }); 39 | } 40 | 41 | /** 42 | * Opens the albums 43 | * @return A collection of urls from the selected images 44 | */ 45 | public open_albums(): Promise> { 46 | return this.image_picker.getPictures({ 47 | quality: 100, 48 | maximumImagesCount: 15, 49 | }); 50 | } 51 | } -------------------------------------------------------------------------------- /app/src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/v2/theming/ 3 | $font-path: "../assets/fonts"; 4 | 5 | @import "ionic.globals"; 6 | 7 | 8 | // Shared Variables 9 | // -------------------------------------------------- 10 | // To customize the look and feel of this app, you can override 11 | // the Sass variables found in Ionic's source scss files. 12 | // To view all the possible Ionic variables, see: 13 | // http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/ 14 | 15 | // Named Color Variables 16 | // -------------------------------------------------- 17 | // Named colors makes it easy to reuse colors on various components. 18 | // It's highly recommended to change the default colors 19 | // to match your app's branding. Ionic uses a Sass map of 20 | // colors so you can add, rename and remove colors as needed. 21 | // The "primary" color is the only required color in the map. 22 | 23 | $colors: ( 24 | primary: #de4f24, 25 | secondary: #7c2b23, 26 | light: #f4f4f4, 27 | dark: #222, 28 | success: #7aa327, 29 | info: #477bbe, 30 | warning: #c79705, 31 | danger: #f53d3d 32 | ); 33 | 34 | // App iOS Variables 35 | // -------------------------------------------------- 36 | // iOS only Sass variables can go here 37 | 38 | // App Material Design Variables 39 | // -------------------------------------------------- 40 | // Material Design only Sass variables can go here 41 | 42 | 43 | 44 | 45 | // App Windows Variables 46 | // -------------------------------------------------- 47 | // Windows only Sass variables can go here 48 | 49 | 50 | 51 | 52 | // App Theme 53 | // -------------------------------------------------- 54 | // Ionic apps can have different themes applied, which can 55 | // then be future customized. This import comes last 56 | // so that the above variables are used and Ionic's 57 | // default are overridden. 58 | 59 | @import "ionic.theme.default"; 60 | 61 | 62 | // Ionicons 63 | // -------------------------------------------------- 64 | // The premium icon font for Ionic. For more info, please see: 65 | // http://ionicframework.com/docs/v2/ionicons/ 66 | 67 | @import "ionic.ionicons"; 68 | 69 | 70 | // Fonts 71 | // -------------------------------------------------- 72 | 73 | @import "roboto"; 74 | @import "noto-sans"; 75 | -------------------------------------------------------------------------------- /app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules" 21 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | } 26 | } -------------------------------------------------------------------------------- /app/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-duplicate-variable": true, 4 | "no-unused-variable": [ 5 | true 6 | ] 7 | }, 8 | "rulesDirectory": [ 9 | "node_modules/tslint-eslint-rules/dist/rules" 10 | ] 11 | } 12 | --------------------------------------------------------------------------------