Merge commit 'b0822ba5fb5b1110291b3d30358ef1d9c2ddde11' into develop

This commit is contained in:
harukin-expo-dev-env 2024-03-08 13:58:14 +00:00
commit f34d342364
16 changed files with 1825 additions and 1104 deletions

4
App.js
View File

@ -135,7 +135,7 @@ export function AppContainer() {
tabBarLabel: "リンク", tabBarLabel: "リンク",
headerTransparent: true, headerTransparent: true,
gestureEnabled: true, gestureEnabled: true,
tabBarIcon: initIcon("ios-radio", "Ionicons"), tabBarIcon: initIcon("radio", "Ionicons"),
}} }}
> >
{(props) => <MenuPage {...props} />} {(props) => <MenuPage {...props} />}
@ -146,7 +146,7 @@ export function AppContainer() {
tabBarLabel: "運行情報", tabBarLabel: "運行情報",
headerTransparent: true, headerTransparent: true,
gestureEnabled: true, gestureEnabled: true,
tabBarIcon: initIcon("md-train", "Ionicons"), tabBarIcon: initIcon("train", "Ionicons"),
tabBarBadge: areaInfo ? "!" : undefined, tabBarBadge: areaInfo ? "!" : undefined,
}} }}
> >

View File

@ -3,7 +3,10 @@
"name": "JR四国運行状況", "name": "JR四国運行状況",
"slug": "jrshikoku", "slug": "jrshikoku",
"privacy": "public", "privacy": "public",
"platforms": ["ios", "android"], "platforms": [
"ios",
"android"
],
"plugins": [ "plugins": [
[ [
"react-native-android-widget", "react-native-android-widget",
@ -21,9 +24,10 @@
} }
] ]
} }
] ],
"expo-font"
], ],
"version": "4.6", "version": "5.0",
"orientation": "default", "orientation": "default",
"icon": "./assets/icon.png", "icon": "./assets/icon.png",
"splash": { "splash": {
@ -35,7 +39,9 @@
"fallbackToCacheTimeout": 0, "fallbackToCacheTimeout": 0,
"url": "https://u.expo.dev/398abf60-57a7-11e9-970c-8f04356d08bf" "url": "https://u.expo.dev/398abf60-57a7-11e9-970c-8f04356d08bf"
}, },
"assetBundlePatterns": ["**/*"], "assetBundlePatterns": [
"**/*"
],
"ios": { "ios": {
"buildNumber": "31", "buildNumber": "31",
"supportsTablet": true, "supportsTablet": true,
@ -51,13 +57,18 @@
] ]
}, },
"entitlements": { "entitlements": {
"com.apple.developer.nfc.readersession.formats": ["TAG"] "com.apple.developer.nfc.readersession.formats": [
"TAG"
]
} }
}, },
"android": { "android": {
"package": "jrshikokuinfo.xprocess.hrkn", "package": "jrshikokuinfo.xprocess.hrkn",
"versionCode": 20, "versionCode": 20,
"permissions": ["ACCESS_FINE_LOCATION", "NFC"], "permissions": [
"ACCESS_FINE_LOCATION",
"NFC"
],
"googleServicesFile": "./google-services.json", "googleServicesFile": "./google-services.json",
"config": { "config": {
"googleMaps": { "googleMaps": {

View File

@ -1,5 +1,9 @@
import React from "react"; import React from "react";
import { FlexWidget, TextWidget } from "react-native-android-widget"; import {
FlexWidget,
TextWidget,
ListWidget,
} from "react-native-android-widget";
export function HelloWidget({ time, delayString }) { export function HelloWidget({ time, delayString }) {
return ( return (
@ -43,8 +47,14 @@ export function HelloWidget({ time, delayString }) {
}} }}
/> />
</FlexWidget> </FlexWidget>
<FlexWidget <ListWidget
style={{ flex: 1, backgroundColor: "#fff", width: "match_parent" }} style={{
flex: 1,
backgroundColor: "#fff",
width: "match_parent",
height: "match_parent",
padding: 10,
}}
> >
{delayString ? ( {delayString ? (
delayString.map((d) => { delayString.map((d) => {
@ -56,6 +66,7 @@ export function HelloWidget({ time, delayString }) {
width: "match_parent", width: "match_parent",
backgroundColor: "#ffffff", backgroundColor: "#ffffff",
}} }}
clickAction="WIDGET_CLICK"
key={data[1]} key={data[1]}
> >
<TextWidget <TextWidget
@ -77,11 +88,13 @@ export function HelloWidget({ time, delayString }) {
<TextWidget <TextWidget
style={{ style={{
color: "#000000", color: "#000000",
fontSize: 20,
}} }}
clickAction="WIDGET_CLICK"
text="現在、5分以上の遅れはありません。" text="現在、5分以上の遅れはありません。"
/> />
)} )}
</FlexWidget> </ListWidget>
</FlexWidget> </FlexWidget>
); );
} }

View File

@ -1,6 +1,6 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { View, Text, TouchableOpacity, Linking } from "react-native"; import { View, Text, TouchableOpacity, Linking } from "react-native";
import * as ExpoFelicaReader from "expo-felica-reader"; import * as ExpoFelicaReader from "../modules/expo-felica-reader/src";
import * as Updates from "expo-updates"; import * as Updates from "expo-updates";
import StatusbarDetect from "../StatusbarDetect"; import StatusbarDetect from "../StatusbarDetect";
import { AS } from "../storageControl"; import { AS } from "../storageControl";

View File

@ -5,8 +5,8 @@ import { WebView } from "react-native-webview";
export default ({ navigation: { navigate }, route }) => { export default ({ navigation: { navigate }, route }) => {
const { info, goTo, useShow } = route.params; const { info, goTo, useShow } = route.params;
const onExit = () => { const onExit = () => {
navigate(goTo); navigate(goTo || "Apps");
useShow(); useShow && useShow();
}; };
return ( return (
<View style={styles.View}> <View style={styles.View}>

View File

@ -0,0 +1,92 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
group = 'expo.modules.felicareader'
version = '0.2.0'
buildscript {
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
if (expoModulesCorePlugin.exists()) {
apply from: expoModulesCorePlugin
applyKotlinExpoModulesCorePlugin()
}
// Simple helper that allows the root project to override versions declared by this library.
ext.safeExtGet = { prop, fallback ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
// Ensures backward compatibility
ext.getKotlinVersion = {
if (ext.has("kotlinVersion")) {
ext.kotlinVersion()
} else {
ext.safeExtGet("kotlinVersion", "1.8.10")
}
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
}
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
}
}
repositories {
maven {
url = mavenLocal().url
}
}
}
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 33)
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.majorVersion
}
}
namespace "expo.modules.felicareader"
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 34)
versionCode 2
versionName "0.2.0"
}
lintOptions {
abortOnError false
}
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
}

View File

@ -0,0 +1,2 @@
<manifest>
</manifest>

View File

@ -0,0 +1,34 @@
package expo.modules.felicareader
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
import expo.modules.kotlin.Promise
import android.nfc.NfcAdapter
import android.nfc.Tag
class NfcReaderCallback(private val promise: Promise) : NfcAdapter.ReaderCallback {
override fun onTagDiscovered(tag: Tag?) {
val idmString = tag?.id?.joinToString("") { "%02x".format(it) }
promise.resolve(idmString)
}
}
class ExpoFelicaReaderModule : Module() {
var nfcAdapter: NfcAdapter? = null
override fun definition() = ModuleDefinition {
Name("ExpoFelicaReader")
AsyncFunction("scan") { promise: Promise ->
nfcAdapter?.enableReaderMode(
appContext.currentActivity,
NfcReaderCallback(promise),
NfcAdapter.FLAG_READER_NFC_F,
null
)
}
OnCreate {
nfcAdapter = NfcAdapter.getDefaultAdapter(appContext.reactContext)
}
}
}

View File

@ -0,0 +1,9 @@
{
"platforms": ["ios", "tvos", "android", "web"],
"ios": {
"modules": ["ExpoFelicaReaderModule"]
},
"android": {
"modules": ["expo.modules.felicareader.ExpoFelicaReaderModule"]
}
}

View File

@ -0,0 +1,27 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '../../../', 'package.json')))
Pod::Spec.new do |s|
s.name = 'ExpoFelicaReader'
s.version = "0.1.0"
s.summary = "A module for reading Felica cards in ExpoKit."
s.description = "Expo FeliCa reader module"
s.license = "MIT"
s.author = "Daiki Urata (https://github.com/7nohe)"
s.homepage = "https://github.com/7nohe/expo-felica-reader#readme"
s.platform = :ios, '13.0'
s.swift_version = '5.4'
s.source = { git: 'https://github.com/7nohe/expo-felica-reader' }
s.static_framework = true
s.dependency 'ExpoModulesCore'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
'SWIFT_COMPILATION_MODE' => 'wholemodule'
}
s.source_files = "**/*.{h,m,swift}"
end

View File

@ -0,0 +1,70 @@
import ExpoModulesCore
import CoreNFC
public class ExpoFelicaReaderModule: Module {
var session: NfcSession?
var semaphore: DispatchSemaphore?
public func definition() -> ModuleDefinition {
Name("ExpoFelicaReader")
AsyncFunction("scan") { (promise: Promise) in
session?.startSession()
DispatchQueue.global(qos: .background).async {
self.semaphore?.wait()
promise.resolve(self.session?.message)
}
}
OnCreate {
semaphore = DispatchSemaphore(value: 0)
session = NfcSession(semaphore: semaphore!)
}
}
}
class NfcSession: NSObject, NFCTagReaderSessionDelegate {
var session: NFCTagReaderSession?
let semaphore: DispatchSemaphore
var message: String?
init (semaphore: DispatchSemaphore) {
self.semaphore = semaphore
}
func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
print("tagReaderSessionDidBecomeActive")
}
func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) {
print("Error: \(error.localizedDescription)")
self.semaphore.signal()
self.session = nil
}
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
let tag = tags.first!
session.connect(to: tag) { error in
if nil != error {
session.invalidate(errorMessage: "Error!")
self.semaphore.signal()
return
}
guard case .feliCa(let feliCaTag) = tag else {
session.invalidate(errorMessage: "This is not FeliCa!")
self.semaphore.signal()
return
}
let idm = feliCaTag.currentIDm.map { String(format: "%.2hhx", $0) }.joined()
self.message = idm
session.alertMessage = "Success!"
session.invalidate()
self.semaphore.signal()
}
}
func startSession() {
self.session = NFCTagReaderSession(pollingOption: [.iso14443, .iso15693, .iso18092], delegate: self, queue: nil)
session?.alertMessage = "Touch your FeliCa!"
session?.begin()
}
}

View File

@ -0,0 +1,5 @@
import { requireNativeModule } from 'expo-modules-core';
// It loads the native module object from the JSI or falls back to
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
export default requireNativeModule('ExpoFelicaReader');

View File

@ -0,0 +1,5 @@
import ExpoFelicaReaderModule from "./ExpoFelicaReaderModule";
export async function scan(): Promise<string> {
return await ExpoFelicaReaderModule.scan();
}

View File

@ -7,53 +7,54 @@
"eject": "expo eject" "eject": "expo eject"
}, },
"dependencies": { "dependencies": {
"@expo/vector-icons": "^13.0.0", "@expo/ngrok": "^4.1.0",
"@react-native-async-storage/async-storage": "1.18.2", "@expo/vector-icons": "^14.0.0",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-native-community/masked-view": "0.1.10", "@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "^5.11.11", "@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/native": "^5.9.4", "@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5", "@react-navigation/stack": "^5.14.5",
"dayjs": "^1.11.9", "dayjs": "^1.11.9",
"eas-cli": "^5.9.1", "eas-cli": "^5.9.1",
"expo": "^49.0.21", "expo": "^50.0.11",
"expo-dev-client": "~2.4.13", "expo-dev-client": "~3.3.9",
"expo-device": "~5.4.0", "expo-device": "~5.9.3",
"expo-felica-reader": "^0.1.0", "expo-font": "~11.10.3",
"expo-font": "~11.4.0", "expo-location": "~16.5.5",
"expo-location": "~16.1.0", "expo-notifications": "~0.27.6",
"expo-notifications": "~0.20.1", "expo-sharing": "~11.10.0",
"expo-sharing": "~11.5.0", "expo-updates": "~0.24.11",
"expo-updates": "~0.18.17", "expo-web-browser": "~12.8.2",
"expo-web-browser": "~12.3.2",
"firebase": "8.2.3", "firebase": "8.2.3",
"lottie-react-native": "5.1.6", "lottie-react-native": "6.5.1",
"native-base": "^2.15.2", "native-base": "^2.15.2",
"npm": "^7.18.1", "npm": "^7.18.1",
"pushy-react-native": "^1.0.18", "pushy-react-native": "^1.0.18",
"react": "18.2.0", "react": "18.2.0",
"react-native": "0.72.6", "react-native": "0.73.4",
"react-native-actions-sheet": "0.8.21", "react-native-actions-sheet": "0.8.21",
"react-native-android-widget": "^0.11.2", "react-native-android-widget": "^0.11.2",
"react-native-auto-height-image": "^3.2.4", "react-native-auto-height-image": "^3.2.4",
"react-native-elements": "^3.4.2", "react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.12.0", "react-native-gesture-handler": "~2.14.0",
"react-native-maps": "1.7.1", "react-native-maps": "1.10.0",
"react-native-reanimated": "^3.6.1", "react-native-reanimated": "~3.6.2",
"react-native-remote-svg": "^2.0.6", "react-native-remote-svg": "^2.0.6",
"react-native-responsive-screen": "^1.4.2", "react-native-responsive-screen": "^1.4.2",
"react-native-router-flux": "^4.3.1", "react-native-router-flux": "^4.3.1",
"react-native-safe-area-context": "4.6.3", "react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.22.0", "react-native-screens": "~3.29.0",
"react-native-snap-carousel": "^3.9.1", "react-native-snap-carousel": "^3.9.1",
"react-native-storage": "^1.0.1", "react-native-storage": "^1.0.1",
"react-native-svg": "13.9.0", "react-native-svg": "14.1.0",
"react-native-svg-uri": "^1.2.3", "react-native-svg-uri": "^1.2.3",
"react-native-vector-icons": "^8.1.0", "react-native-vector-icons": "^8.1.0",
"react-native-view-shot": "3.7.0", "react-native-view-shot": "3.8.0",
"react-native-webview": "^13.6.3" "react-native-webview": "13.6.4",
"typescript": "^5.3.0"
}, },
"devDependencies": { "devDependencies": {
"babel-preset-expo": "^9.5.0" "babel-preset-expo": "^10.0.0"
}, },
"private": true "private": true
} }

4
tsconfig.json Normal file
View File

@ -0,0 +1,4 @@
{
"compilerOptions": {},
"extends": "expo/tsconfig.base"
}

2580
yarn.lock

File diff suppressed because it is too large Load Diff