Skip to content

Commit

Permalink
v350: bump to 1.11; fix lots of problems on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
iebb committed Mar 5, 2025
1 parent 487f9da commit 25d864c
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 53 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- Android < 12 -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Add this line if your application always requires BLE. More info can be found on:
https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#permissions
Expand Down
4 changes: 2 additions & 2 deletions ios/NekokoLPA/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.11.349</string>
<string>1.11.350</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>349</string>
<string>350</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nekokolpa",
"buildVersion": 349,
"version": "1.11.349",
"buildVersion": 350,
"version": "1.11.350",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down Expand Up @@ -101,4 +101,4 @@
"node": ">=18"
},
"packageManager": "[email protected]"
}
}
36 changes: 16 additions & 20 deletions src/native/adapters/9esim_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export class SimLinkAdapter implements Device {
this.device = device;
}

async refresh(): Promise<boolean> {
await this.disconnect();
return await this.connect();
}

async connect(): Promise<boolean> {
try {
if (!await this.device.isConnected()) {
Expand All @@ -36,37 +31,36 @@ export class SimLinkAdapter implements Device {
} else {
console.log("already connected...");
}

const resp = await this.transmitRaw({cmd: "getElpaInfo"});
if ((resp as any).software.localeCompare("2.3.1") <= 0) {
this.description = "Minimum firmware v2.3.1 required";
return false;
}

await this.transmitRaw({cmd: "APDU", action: 2});
await this.transmitRaw({cmd: "APDU", action: 0});
await this.transmit("80AA00000AA9088100820101830107"); // APDU_TERMINAL_CAPABILITIES
const channelResp = await this.transmit("0070000001");
const channel = channelResp.substring(0, 2);
this.channel = channel[1];
if (parseInt(channel) > 3) {
this.description = "Too many opened channels";
if (channelResp[0] == "6" && channelResp[1] != "1") {
this.description = `Failed to open channel`;
this.available = false;
return false;
}
if (parseInt(channel, 10) > 3) {
this.description = `Too many opened channels, ${channel}`;
this.available = false;
return false;
}



for(const aid of AIDList.split(",")) {
try {
const aidResp = await this.transmit(channel + "A4040010" + aid);
if (aidResp === "6a82") {
} else {
if (aidResp.startsWith("61")) {
this.available = true;
return true;
} else {
}
} catch (e) {

}
}
this.description = "No supported AID found";
return false;
} catch (error: any) {
console.log("CCID Connect Err", error);
Expand All @@ -76,8 +70,10 @@ export class SimLinkAdapter implements Device {
}

async disconnect(): Promise<boolean> {
await this.transmitRaw({cmd: "APDU", action: 2});
await this.device.cancelConnection();
try {
await this.transmitRaw({cmd: "APDU", action: 2});
await this.device.cancelConnection();
} catch (error) {}
return true;
}

Expand Down
28 changes: 21 additions & 7 deletions src/native/adapters/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Device {
accessRule?: () => Promise<boolean>;
disconnect: () => Promise<boolean>;
refresh: () => Promise<boolean>;
reconnect: () => Promise<boolean>;
transmit: (s: string) => Promise<string>;
}

Expand Down Expand Up @@ -58,22 +59,25 @@ export class Adapter {
Adapters[device.deviceId] = this;
}

async refresh(): Promise<boolean> {
async reconnect(): Promise<boolean> {
await this.disconnect();
return await this.connect();
}

async connect() {
try {
if (!this.connected) {
await this.device.connect();
if (await this.device.connect()) {
this.connected = true;
return true;
}
}
this.connected = true;
return true;
} catch {
this.connected = false;
return false;
}
this.connected = false;
return false;
}

async disconnect() {
Expand All @@ -89,9 +93,19 @@ export class Adapter {
}

async initialize() {
await this.connect();
await this.getEuiccInfo();
await this.getProfiles();
if (await this.connect()) {
await this.getEuiccInfo();
await this.getProfiles();
}
}

async refresh() {
try {
await this.getEuiccInfo();
await this.getProfiles();
} catch {
await this.initialize();
}
}

async _execute(s: string, args: any[]): Promise<any> {
Expand Down
20 changes: 9 additions & 11 deletions src/native/adapters/ccid_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ export class CCIDDevice implements Device {
this.description = "Channel cannot be opened";
return false;
}

for(const aid of AIDList.split(",")) {
const aidResp = await this.transmit(channel + "A4040010" + aid);
if (aidResp === "6a82") {
} else {
this.available = true;
return true;
try {
const aidResp = await this.transmit(channel + "A4040010" + aid);
if (aidResp.startsWith("61")) {
this.available = true;
return true;
} else {
}
} catch (e) {

}
}
this.description = "No supported AID found";
Expand All @@ -65,10 +68,5 @@ export class CCIDDevice implements Device {
return await CCIDPlugin.transceive(this.deviceName, s);
}

async refresh(): Promise<boolean> {
await this.disconnect();
return await this.connect();
}


}
10 changes: 3 additions & 7 deletions src/native/adapters/estk_red_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export class ESTKmeRED implements Device {
this.device = device;
}

async refresh(): Promise<boolean> {
await this.disconnect();
return await this.connect();
}

async connect(): Promise<boolean> {
try {
if (!await this.device.isConnected()) {
Expand All @@ -78,15 +73,16 @@ export class ESTKmeRED implements Device {
for(const aid of AIDList.split(",")) {
try {
const aidResp = await this.transmit(channel + "A4040010" + aid);
if (aidResp === "6a82") {
} else {
if (aidResp.startsWith("61")) {
this.available = true;
return true;
} else {
}
} catch (e) {

}
}
this.description = "No supported AID found";
return false;
} catch (error: any) {
console.log("CCID Connect Err", error);
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Main/ProfileSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function ProfileSelector({ deviceId } : { deviceId: string }) {
refreshControl={
<RefreshControl refreshing={refreshing} onRefresh={() => {
setRefreshing(true);
adapter.initialize();
adapter.refresh();
setRefreshing(false);
}} />
}
Expand Down
2 changes: 1 addition & 1 deletion src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function initializeTheme(primaryColor: string) {
}
});

ThemeManager.setComponentTheme('Button', (props, context) => {
ThemeManager.setComponentTheme('Button', (props: any, context: any) => {
return {
backgroundColor: Colors.buttonBackground,
color: Colors.buttonForeground,
Expand Down

0 comments on commit 25d864c

Please sign in to comment.