Skip to content

Commit

Permalink
feat: intial android implementatin
Browse files Browse the repository at this point in the history
  • Loading branch information
felixerdy committed Sep 12, 2023
1 parent e56c262 commit 26df8db
Show file tree
Hide file tree
Showing 16 changed files with 4,217 additions and 4,093 deletions.
101 changes: 101 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore

# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof

# Cordova plugins for Capacitor
capacitor-cordova-android-plugins

# Copied web assets
app/src/main/assets/public

# Generated Config files
app/src/main/assets/capacitor.config.json
app/src/main/assets/capacitor.plugins.json
app/src/main/res/xml/config.xml
20 changes: 20 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-community-background-geolocation')
implementation project(':capacitor-community-bluetooth-le')

}


if (hasProperty('postBuildExtras')) {
postBuildExtras()
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
mavenCentral()
Expand Down
9 changes: 9 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')

include ':capacitor-community-background-geolocation'
project(':capacitor-community-background-geolocation').projectDir = new File('../node_modules/@capacitor-community/background-geolocation/android')

include ':capacitor-community-bluetooth-le'
project(':capacitor-community-bluetooth-le').projectDir = new File('../node_modules/@capacitor-community/bluetooth-le/android')
6 changes: 3 additions & 3 deletions capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const config: CapacitorConfig = {
appId: 'com.example.app',
appName: 'senseBox:Bike X SIMPORT',
webDir: 'out',
server: {
url: 'http://192.168.0.220:3000',
},
// server: {
// url: 'http://192.168.0.220:3000',
// },
}

export default config
12 changes: 6 additions & 6 deletions ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"appId": "com.example.app",
"appName": "senseBox:Bike X SIMPORT",
"webDir": "out",
"server": {
"url": "http://192.168.0.220:3000"
}
"appId": "com.example.app",
"appName": "senseBox:Bike X SIMPORT",
"webDir": "out",
"server": {
"url": "http://192.168.0.220:3000"
}
}
15 changes: 7 additions & 8 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { TopBar } from "@/components/ui/TopBar";
import "../styles/globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { Navbar } from "@/components/ui/Navbar";
import { cn } from "@/lib/utils";
import { Toaster } from "@/components/ui/toaster";

import { TopBar } from '@/components/ui/TopBar'
import '../styles/globals.css'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import { Navbar } from '@/components/ui/Navbar'
import { cn } from '@/lib/utils'
import { Toaster } from '@/components/ui/toaster'

const inter = Inter({ subsets: ['latin'] })

Expand Down
2 changes: 1 addition & 1 deletion src/components/Wizard/OpenSenseMapLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function OpenSenseMapLogin() {
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl>
<Input placeholder="Email" {...field} />
<Input type="email" placeholder="Email" {...field} />
</FormControl>
<FormMessage />
</FormItem>
Expand Down
11 changes: 5 additions & 6 deletions src/components/Wizard/SelectDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import { useSwiper } from 'swiper/react'
export default function SelectDevice() {
const boxes = useAuthStore(state => state.boxes)

const swiper = useSwiper();
const [selectedBox, setSelectedBox] = useState("");
const swiper = useSwiper()
const [selectedBox, setSelectedBox] = useState('')
const selectBox = (box: string) => {
setSelectedBox(box);
useAuthStore.setState({ selectedBox: box });
};

setSelectedBox(box)
useAuthStore.setState({ selectedBox: box })
}

return (
<div className="flex h-full w-full flex-col items-center justify-center gap-4">
Expand Down
32 changes: 16 additions & 16 deletions src/components/ui/card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react"
import * as React from 'react'

import { cn } from "@/lib/utils"
import { cn } from '@/lib/utils'

const Card = React.forwardRef<
HTMLDivElement,
Expand All @@ -9,25 +9,25 @@ const Card = React.forwardRef<
<div
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className
'rounded-lg border bg-card text-card-foreground shadow-sm',
className,
)}
{...props}
/>
))
Card.displayName = "Card"
Card.displayName = 'Card'

const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
className={cn('flex flex-col space-y-1.5 p-6', className)}
{...props}
/>
))
CardHeader.displayName = "CardHeader"
CardHeader.displayName = 'CardHeader'

const CardTitle = React.forwardRef<
HTMLParagraphElement,
Expand All @@ -36,44 +36,44 @@ const CardTitle = React.forwardRef<
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight",
className
'text-2xl font-semibold leading-none tracking-tight',
className,
)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"
CardTitle.displayName = 'CardTitle'

const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
CardDescription.displayName = 'CardDescription'

const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
))
CardContent.displayName = "CardContent"
CardContent.displayName = 'CardContent'

const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex items-center p-6 pt-0", className)}
className={cn('flex items-center p-6 pt-0', className)}
{...props}
/>
))
CardFooter.displayName = "CardFooter"
CardFooter.displayName = 'CardFooter'

export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
16 changes: 8 additions & 8 deletions src/components/ui/slider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
'use client'

import * as React from "react";
import * as SliderPrimitive from "@radix-ui/react-slider";
import * as React from 'react'
import * as SliderPrimitive from '@radix-ui/react-slider'

import { cn } from "@/lib/utils";
import { cn } from '@/lib/utils'

const Slider = React.forwardRef<
React.ElementRef<typeof SliderPrimitive.Root>,
Expand All @@ -12,7 +12,7 @@ const Slider = React.forwardRef<
<SliderPrimitive.Root
ref={ref}
className={cn(
"relative flex w-full touch-none select-none items-center",
'relative flex w-full touch-none select-none items-center',
className,
)}
{...props}
Expand All @@ -22,7 +22,7 @@ const Slider = React.forwardRef<
</SliderPrimitive.Track>
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
</SliderPrimitive.Root>
));
Slider.displayName = SliderPrimitive.Root.displayName;
))
Slider.displayName = SliderPrimitive.Root.displayName

export { Slider };
export { Slider }
14 changes: 7 additions & 7 deletions src/components/ui/switch.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"use client"
'use client'

import * as React from "react"
import * as SwitchPrimitives from "@radix-ui/react-switch"
import * as React from 'react'
import * as SwitchPrimitives from '@radix-ui/react-switch'

import { cn } from "@/lib/utils"
import { cn } from '@/lib/utils'

const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitives.Root>,
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
className
'peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
className,
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
)}
/>
</SwitchPrimitives.Root>
Expand Down
Loading

0 comments on commit 26df8db

Please sign in to comment.